Search code examples
excelvbadymo

Printing to DYMO Printer from Excel VBA


I found some code online that says that you can print a label onto the Dymo printer. I have the reference DYMO Label Software v.8 reference enabled. The Code is as follows:

Dim myDymo As DYMO_DLS_SDK.DymoHighLevelSDK
Dim dyAddin As DYMO_DLS_SDK.ISDKDymoAddin
Dim dyLabel As DYMO_DLS_SDK.ISDKDymoLabels

Set myDymo = New DYMO_DLS_SDK.DymoHighLevelSDK

Set dyAddin = myDymo.DymoAddin
Set dyLabel = myDymo.DymoLabels

dyAddin.SelectPrinter dyAddin.GetDymoPrinters

dyAddin.Open Environ$("USERPROFILE") & "\My Documents\DYMO Label\Labels\BoardFile.label"
dylabe.SetField "Text", "Lot Number: " & Range("A" & LR + 1) & vbCr & "Item Number: " & Range("B" & LR + 1) & vbCr & "Order Number:" & Range("E" & LR + 1)
dyAddin.Print2 1, True, 1

Set myDymo = Nothing

There is no error code but no label gets printed either so I'm lost on what to do next.


Solution

  • You have an error in the posted code (missing the 'l' in label):

    dylabe.SetField "Text",
    

    However, I tried to run as you have it and vba threw an error at that line, which you say you don't get - so I assume that was an error in your question and not your code.

    I had a play around, and a likely reason is that your path to the label file is not correct. If I point vba to a non-existent label, it will print a few times using the last used label file, then start playing up and stop printing.

    Could you please check this line is correct?:

    dyAddin.Open Environ$("USERPROFILE") & "\My Documents\DYMO Label\Labels\BoardFile.label"
    

    Are you able to print using the dymo software?