
#Visual basic print command code#
Printer.Print Space( 1) ' initialize hDC of Printer object ' set the same DPI resolution (300 DPI) to generate barcode imageīC.Symbology = 0 ' Code 39 = 0 (see the documentation for other barcode types) ' set barcode valueīC.Value = "1234567890" ' use. Printer.PrintQuality = DPIQuality ' set the printer quality to 300 dpi ' IMPORTANT: call Printer.Print Space(1) to initialize the Printer ' this is how Microsoft advises to do in their KB article (search for Printer.Print string): ' this method prints a barcode via temporary EMF metafile allowing to set target physical size and DPI resolution quality Const DPIQuality = 300 ' 300 DPI as printing resolution (DPI) quality Const WidthInInches = 4 ' 4 inches as width for the barcode generated Const HeightInInches = 1 ' 1 inches as height for the barcode generated ' create barcode object as ActiveX Dim BC SelectPrinter = True Exit For End If Next iĮnd Function ' print barcode to the Printer object Private Sub PrintBarCode() SelectPrinter = False For i = 0 To Printers.Count - 1 ' if the specified printer is found, select it and return True If Printers(i).DeviceName = printer_name Then Set Printer = Printers(i)


Index = Index + 1 Next If CurrentPrinter -1 ThenĬboPrinterList.ListIndex = CurrentPrinterĮnd If End Sub '= 'Function to select printer '= Function SelectPrinter( ByVal printer_name As String) As Boolean Dim i As Integer If Printer.DeviceName = dev.DeviceName Then ' call function to print barcode to Printer object Call PrintBarCodeĮnd Sub ' populate list of printers on form load Private Sub Form_Load()ĭim dev As Printer, Index As Integer, CurrentPrinter As Integer ' set printer to the selected printer Call SelectPrinter(cboPrinterList.Text) NET Framework 1.10 please use this link: Private Sub Command1_Click()

#Visual basic print command download#
NET Framework 1.10 installed to use BarCode SDK from Visual Basic ' to download and install. Caption = "Print Barcode to the selected printer with 300 DPI quality and physycal size (4x1 inches)"Īttribute VB_Exposed = False ' IMPORTANT NOTE: you need to have.
