Hi,
I'm really hoping someone can help me.
I am engraving pet tags and each tag has different names on them. I have tag jig files made up that have each pet tag shape and inside each tag has variable lines eg : <tag16line1> please see image.I also have TXT files that has the details (pets names) that need to be imported into the variable lines of each tag in the jig file (image attached). I have no idea how to import them into this file. Hoping someone can please help me?
Hello everyone, I see that the discussion is quite advanced. I am offering my code which I use to solve similar problems. Things like Mail Merge in Corel have quite a few issues, especially in older versions, and I've turned it off entirely. The data file is in Excel. Adaptation of the code to receive data from a *.txt file is possible. It can be given from the text file to open in Excel. For the code to work, the required Excel data file pets.xlsx is open.
In column A, dogname1…dogname20 are recorded. Column B contains OwnerName1…OwnerName20. In column C are recorded OwnerTel1…OwnerTel20.
My code is not perfect and can certainly be written better. It has some solutions that can increase the user's performance in solving such tasks. Corel file contains Fields_Layer, Cut_Layer, Layer_New.
Currently the code works with 20 entries /20 pet names/ but this can easily be changed.
Principle of operation: /I will not comment on the possible improvements, there are many/
Now the code only handles DogName. OwnerName, OwnerTel processing can be done in a similar way.
Greetings!
Here is the code:
Private Sub CommandButton110_Click()
Dim myobjectXL As Excel.Application
Set myobjectXL = GetObject(, "Excel.Application") 'refers to open instance of Excel
Set myrange = myobjectXL.Worksheets(1).Range("A:A") 'List of pets names
CountOfPets = myobjectXL.WorksheetFunction.CountA(myrange)
Dim DSHAPE As Shape
For Each DSHAPE In ActivePage.Layers("FIELDS_LAYER").Shapes
flag = flag + 1
If DSHAPE.Type = 6 Then
If DSHAPE.Text.Range(0, 1000) = "DogName" Then
VCENTERX = DSHAPE.CenterX
VCENTERY = DSHAPE.CenterY
Dim s1 As Shape
Set s1 = ActivePage.Layers("LAYER_NEW").CreateArtisticText(1.771646, 11.417315, myobjectXL.Worksheets(1).Cells(flag, "A").Value)
s1.Fill.UniformColor.CMYKAssign 0, 0, 0, 100
s1.Outline.SetNoOutline
s1.Text.Range(0, 100).Size = 10 ‘Font Size
With s1
.CenterX = VCENTERX
.CenterY = VCENTERY
End With
End If
Next
Me.Hide
ActivePage.Layers("FIELDS_LAYER").Visible = False
ActivePage.Layers("LAYER_NEW").Visible = True
End Sub
Thanks for this.I don't really understand. Where do I put this code?
Thanks
Hello,1. Open Visual Basic Editor - Alt-F11 on Corel X32. Insert new User Form or use existing user form. Rename the new form to ufStart, by example2.1. Modal property of ufStart must be set to False / Not modal 3. Create new Command button - drag/drop Command Button control from Toolbox4. Rename the above created button to CommandButton1105. Caption of so created button can be anything, by example "START" and can be edited from Button properties window/panel6. Double click on created button to open Command panel of created button7. Copy/Paste the code above, Private Sub CommandButton110_Click().......End Sub included8.In any command module copy/paste this sub:Sub myStartForm()ufStart.showEnd Sub9. Assign any functional key - F2-F12 or any unused key combination to run sub myStartForm. You may menu row or menu button to myStartFormHope, this will be helpful Greetings!