Printing to a DYMO LabelWriter 450 from VBA

I recently had to make some file folders at work. About five minutes after I was done, I purchased a DYMO LabelWriter 450. I was using one of those label makers where you punch in the text, hit print, and press down on a lever to cut the label. Then you have to take a pair of scissors and cut along the dotted line to get the right length. THEN you have to spend ten minutes fumbling with the backing. Brutal.

When I installed the software, it installed quite a few libraries. I wasn’t sure which one to pick, but after a little experimenting, I chose the Dymo Label Software v.8 SDK.

With my reference set, I tried a few different objects without much success. If there’s documentation for this, I haven’t found it. As usual, the object model leaves a lot to be desired. Nevertheless, I persevered and came up with this:

Let’s step through this and try to see what’s happening. I start with a DymoHighLevelSDK object – what an awful name. This object has two properties: DymoAddin (what an awful name) and DymoLabels. From what I can tell, DymoLabels is only one label, from which I can only conclude…wait for it…they gave it an awful name. I needed to create both the DymoAddin object and the DymoLabels object. I would have thought that I could get the current label from the DymoAddin object, but that doesn’t appear to be the case.

I set the printer I want to use using SelectPrinter and GetDymoPrinters. I guess if you have more than one Dymo printer, GetDymoPrinters returns some delimited string. But I only have one, so I don’t know. Either way, it’s stupid. I discovered that GetDymoPrinters returns my one printer, so I pass that to SelectPrinter and that seems to have worked.

Next I open my .label template file. There’s also an Open2 method, but I don’t know the difference. Am I done bashing the DYMO programmers yet? Not even close. If you have two Open methods, don’t freaking name them Open and Open2. Name them something understandable like Open and OpenPriorVersion.

I tried

but got a Type Mismatch error. As far as I can tell, when I call the Open method to the DymoAddin object, the DymoLabels object automatically becomes whatever was open. Idiotic.

My label has one object on it called “Text”, so the SetField method was pretty straight forward. It reminds me of Quickbooks in that there are few, if any, properties and everything is a method.

Finally I tried the Print method, but was rewarded with “Object doesn’t support this property or method.” One of my favorite errors. Out of desperation, I chose the Print2 method. I had to include a third argument for PaperTray, which is utterly ludicrous if you look at the LabelWriter 450. But it worked.

I wanted to set the ShrinkToFit property of the Textbox to TRUE, but I couldn’t figure out how to do it. It did it automatically because I set that “property” when I created the label template, but it would be nice to be able to set it in code.

If I had written the object model, my code would have looked like this:

Anyway, this post should get a million hits. Or maybe it will just get 100% of the hits from the 12 people who care about this.

18 thoughts on “Printing to a DYMO LabelWriter 450 from VBA

  1. I had to set up a job to print barcodes & text to some Dymo printers, I think exactly the same model, a couple of years ago so started playing around with their add-in.

    I ended up just setting a sheet’s page properties to fit the label and sending a formatted range to it, seemed easier that mucking about with an add-in that would have to be checked for and installed every time a new PC was used.

  2. Thanks for sharing. Not only for this recipe, but more generally showing that it is possible to dive in blind & figure out a model like this without going nuts.

  3. I recently purchased Bartender application for printing barcode labels. It is very slick and plays well with Excel and databases.

  4. I’m using twin turbo 450. Does anyone know how to programmically select which roll to print from? If one roll is out of paper, how can I tell it to print from the other roll?

  5. Hi,
    the second example hods on the second line. user-defined type not defined.
    I did include de reference as shown at the beginning and the first exapmle works.

    Anonyone knows another clear tutorial on the web?

  6. Many thanks. I was pulling my hair out. The DYMO people should pay you $ for this. Saved me much pain, wish I had found this pearl yesterday.

  7. Is there a way to utilize print2 to print a SS range to the twin turbo like a regular printer without using the dymo application?

  8. Sub Print_Labels()
    ‘Dim a, b
    The following code worked for four years until we got office updates yesterday. Then Error 429, and could not create the object errors.

    Using your “”Dim myDymo as DYMO_DLS_SDK.DymoHighLevelSDK” and “Set dyAddin = myDymo.DymoAddin” fixed the problem. Thanks a bunch.

    ”Dim newMat As String
    ”Dim qnty
    ‘Dim myDymo As Object
    ‘Dim myLabel As Object
    ‘Dim bCode

    ‘ Sheets(“Toolkit Orders”).Select

    ‘Set myDymo = CreateObject(“Dymo.DymoAddIn”)
    ‘Set myLabel = CreateObject(“Dymo.DymoLabels”)

  9. Thank you so much for this code. Successfully implemented it on a system with Windows 7 / office 2013 (MS Access VBA) / DYMO LabelWriter Twin Turbo.
    However, I create each .label file individually via FSO and then print it with the above mentioned code. Works just as fine =)

  10. Awesome, thanks! Question.. to print multiple labels, do I just wrap these two lines in a loop:

    dyLabel.SetField “Text”, “My text goes here”
    dyAddin.Print2 1, True, 1

    Or, do I have to call the whole function for each label, obviously with a parameter for the text to be printed?

  11. Yes, Jon, I’m pretty sure you can just put those in a loop and not have to do all the other stuff every time.

  12. Thanks a lot for this post as it helped a great deal in quickly being able to print a label from Access. Keep it up!

Leave a Reply

Your email address will not be published. Required fields are marked *