I have the following code that I am hoping to get working. The code will check for available DYMO printers and print the label. You are to create a template label and I saved mine as template.label. In that template label I have a text field referenced as TEXT1.

The followin is the code:

Dim myDymo As Object
        Dim myLabel As Object
        Dim sPrinters As String
        Dim arrPrinters() As String
        Dim i As Long, i2 As Long, iStart As Long

        On Error Resume Next

        myDymo = CreateObject("Dymo.DymoAddIn")
        myLabel = CreateObject("Dymo.DymoLabels")

        If (myDymo Is Nothing) Or (myLabel Is Nothing) Then
            MsgBox("Unable to create OLE objects")
            Exit Sub
        End If

        'Check forDymo printer(s)
        'If there is one proceed and store the printernames in a variable, else quit
        sPrinters = myDymo.GetDymoPrinters()

        If sPrinters = "" Then
            Exit Sub
        Else

            i2 = 0
            iStart = 1

            For i = 1 To Len(sPrinters)

                If Mid(sPrinters, i, 1) = "|" Then
                    i2 = i2 + 1
                    ReDim Preserve arrPrinters(i2 + 1)
                    arrPrinters(i2) = Mid(sPrinters, iStart, i - iStart)
                    iStart = i + 1
                End If

            Next i

        End If

        With myDymo

            '0 is first Dymo printer, you could use the printername instead: SelectPrinter "YourPrintername"
            .SelectPrinter(arrPrinters(0))
        End With

        'Open the label template
        Dim LabelPathString As String = CurDir() & "\Docs\template.label"
        myLabel = myDymo.Open(LabelPathString)

        'Give text object TEXT1 on the label a value
        With myLabel
            '.textobject("TEXT1", "Text to be displayed")
            .setObjectText("TEXT1", "Text to be displayed")
            '.SetField("TEXT1", "Text to be displayed")
        End With

        'Print the label
        With myDymo
            .Print(2, False) ' Print 2 copies
        End With

        'Clean up
        myLabel = Nothing
        myDymo = Nothing

It sends the print job to the DYMO printer, but the label advances with no text on it. If anyone could help, that would be great. Thanks.

P.S. I have tried these 3 options in the code, but none seem to work:

With myLabel
            '.textobject("TEXT1", "Text to be displayed")
            .setObjectText("TEXT1", "Text to be displayed")
            '.SetField("TEXT1", "Text to be displayed")
        End With

I have solved my problem with a little perseverance (did i spell that right?)
Here is the code for anyone interested:

Sub PrintLabels()

        'Open the label template
        Dim LabelPathString As String = CurDir() & "\Docs\template.label"

        Dim label = DYMO.Label.Framework.Label.Open(LabelPathString)
        label.SetObjectText("NAME", TextBox2.Text & ", " & TextBox1.Text)
        label.SetObjectText("HEALTH", "Health #:" & TextBox13.Text & " " & TextBox14.Text)
        label.SetObjectText("DOB", "DOB: " & DateTimePicker1.Text & " (" & TextBox17.Text & ")")
        label.SetObjectText("PTADDRESS", TextBox4.Text & vbCrLf & TextBox5.Text & ", " & TextBox6.Text & "  " & TextBox7.Text & vbCrLf & TextBox8.Text)

        'get a reference to first connected label printer
        Dim printer As DYMO.Label.Framework.ILabelWriterPrinter = DYMO.Label.Framework.Framework.GetLabelWriterPrinters().First()

        label.Print(printer)
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.