Use visual basic 8.0
Dymo labelwriter 400
Installed Dymo labelwriter 400 Software Development Kit (SDK).
My problem is that there is a label is printed, but the mylabel. SetField are not included in the barcode label. The default values are printed.
The object name in the label are correct (OText1 and OText2).
The objects are OText1 and OText2 Variable text object.
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
Set myDymo = CreateObject("Dymo.DymoAddIn")
Set myLabel = CreateObject("Dymo.DymoLabels")
If (myDymo Is Nothing) Or (myLabel Is Nothing) Then
MsgBox "Unable to create OLE objects"
Exit Sub
End If
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
sDefaultPrinter = Application.ActivePrinter
With myDymo
.SelectPrinter arrPrinters(0)
End With
'Open the label template
myLabel = myDymo.Open("C:\SomeFolder\test.LWL")
'Give text objects OText1 and OText2 on the label a value myLabel
myLabel .SetField( "OText1", "123456")
myLabel.SetField ("OText2", "artcile x")
'Print the label
myDymo.print(1,fasle)
'Make sure the default printer is selected again
Application.ActivePrinter = sDefaultPrinter
'Clean up
Set myLabel = Nothing
Set myDymo = Nothing
What am I forgetting the code or code which is wrong
Thanks in advance,
André