I am creating a series of ActiveX labels for two categories of information in a Microsoft Word VBA script. The categories of information are: Fiscal year (FY) and Contract Yield (CY). I am creating the labels to be placed within designated cells of a series of tables. I want to change the names of the labels to match up with their category. For example, label1 would be named to FY1. I need to change the names of these labels so they could eventually match up with data in an Excel spreadsheet.
I am getting stuck at the renaming portion (ActiveDocument.Label1.Name = "FY").
Dim num As Integer
Dim TableNo As Integer
Dim seq As Integer
TableNo = ActiveDocument.Tables.Count
num = 4
seq = 1
'' Labels for "FY"
Do
ActiveDocument.Tables(num).cell(6, 2).Range.InlineShapes.AddOLEControl ClassType:="Forms.Label.1"
ActiveDocument.Label1.Name = "FY"+ seq
seq = seq + 1
num = num + 1
Loop Until num = TableNo + 1
'''Next Group of labels for "CY"
num = 4
seq = 1
Do
ActiveDocument.Tables(3).cell(8, 2).Range.InlineShapes.AddOLEControl ClassType:="Forms.Label.1"
ActiveDocument.Label1.Name = "CY"+ seq
seq = seq + 1
num = num + 1
Loop Until num = TableNo + 1
There is a related article but I can't see how the examples would relate.
** My labels will be inserted in the 4th table of the document, which is why I used num = 4.