Dymo Add-in coding



Hi all,

I'm trying to send some text to a Dymo labelwriter printer using some code I
found in the Dymo SDK. Each time I print this, a label is printed but it's
blank - what have I missed here??

Dim FileStr As String, FileStrDDE As String
Dim PasteDDE As String, DDEStr As String, strPipe As String, Desc As String
Dim hKey As Long, cb As Long, path As String
strPipe = "|"
FileStr = "Address (30252, 30320).LWL"

'Read label files path from the Registry
RegOpenKeyEx HKEY_CURRENT_USER, "Software\DYMO\LabelWriter\Directories", 0,
RegQueryValueExNULL hKey, "Label Directory", 0&, REG_SZ, 0&, cb
path = String(cb, 0)
RegQueryValueExString hKey, "Label Directory", 0&, REG_SZ, path, cb
path = Left(path, cb - 1) + "\"

FileStrDDE = "Open(" + path + FileStr + ")"

On Error Resume Next
Call GetDesc(Desc) 'gets description of current
Call GetObject(Obj) 'defines object to paste text to
Call StartDDE 'opens the DDE conversation
DDEExecute Channum, FileStrDDE 'opens the template in DLS
using the correct label type
PasteDDE = "SetObjectText(" + Obj + "," + strTextToPrint + ")"
DDEExecute Channum, PasteDDE 'paste the text
DDEExecute Channum, "SetObjectText(Title," + BadgeTitle + ")"
DDEExecute Channum, "Print" 'print the label

Thanks and kind regards


Paul Shapiro

I wrote a class module for printing on a Dymo labelwriter with an optional
label preview, but here's the simplified code for printing. Email me (making
the obvious corrections to my email address) if you want the full module
'Set the top-level dymo object
Set moLabelEngine = CreateObject("Dymo.LabelEngine")
'open the template using the default label type
Me.TemplateFile = pjsGetCurrentDBPath() & mcstrDefaultLabelTemplate
'Assign the address to be printed
moLabelText.Text = mstrAddress
fSuccess = moLabelEngine.PrintLabel(DeviceName:=strPrinter, _
Port:="", Quantity:=1, bShowDialog:=False)

Public Property Let TemplateFile(NewValue As String)
mstrTemplateFile = NewValue
Call moLabelEngine.OpenFile(FileName:=mstrTemplateFile)
'Set the address field
Set moLabelObject = moLabelEngine.PrintObject.LabelObject( _

'Get an object with the LabelAddress interface
Set moLabelAddress = moLabelObject
With moLabelAddress
.BarCodePosition = 2 'Under the address
.b9DigitOnly = False
End With

'The address text properties
Set moLabelText = moLabelAddress.TextAttributes
With moLabelText
.Font_1 = "Times New Roman, 12, Bold"
.Font_2 = "Times New Roman, 12, Regular"
.Justify = 3 'Center block horizontally
.VJustify = 1 'Center vertically
.TextColor = 0
.BackGroundColor = RGB(255, 255, 255)
End With

Exit Property
End Property

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question