Search code examples
vbadymo

Getting Object Names of Dymo Label


Noob here just trying to speed up an annoying process at work.

I have many Dymo .label files and I'd like to get the names of the objects within it into an array. I've tried many things with Label.ObjectNames but as I say I'm only new to this and have no idea how to get this working in VBA.

This is as far as I've gotten, I'll eventually have this set up as a function for each label file:

Sub Main()
 Dim Label As DYMO_Label_Framework.ILabel
 Dim dymoFRAME As DYMO_Label_Framework.IFramework
 Set dymoFRAME = New DYMO_Label_Framework.Framework
 Set Label = dymoFRAME.OpenLabel("C:\Users\... ...\DetailedType4.label")
End Sub

If someone can show me an example and a brief explanation of how ObjectNames works I would be eternally grateful (I'm not one for stealing code without understanding it).

The labels have text fields in them, each is named by the property that needs to be inserted into that field. So I'd like to be able to extract into a normal dynamic array the names of each text field, "Project","PartNo","Description","Revision". I hope this helps –

Thanks in advance!


Solution

  • You can do :

    Set LabelObject = Label.GetObjectNames(true)