I created an MS Word template which has a couple of labels called "lblSite" and "lblStatus" on it. When the user clicks on these labels, the click event is fired and some code that I wrote is executed.
Everything was working fine until I added the following line to create a label on the fly:
Set ctrlLabel = Selection.InlineShapes.AddOLEControl(ClassType:="Forms.Label.1", Range:=Selection.Range)
After this line is executed, the click events for "lblSite" and "lblStatus" no longer fire when I click those labels. However, if I exit the word document and then reopen it everything works fine.
Do I need to do some kind of clean up after using AddOLEControl? If not, does anyone have an idea as to what could be happening?
Everything was working fine until I added the following line to create a label on the fly:
Set ctrlLabel = Selection.InlineShapes.AddOLEControl(ClassType:="Forms.Label.1", Range:=Selection.Range)
After this line is executed, the click events for "lblSite" and "lblStatus" no longer fire when I click those labels. However, if I exit the word document and then reopen it everything works fine.
Do I need to do some kind of clean up after using AddOLEControl? If not, does anyone have an idea as to what could be happening?