O
ontheball
I am trying to insert a button onto the document from a click event a button
on a user form. I can do that sucessfully, but I am unable to add the code to
"ThisDocument" to handle the click event of the newly created button. I am
getting an error that says "the object invoked has disconnected from its
clients". This error occurs on the following line:
ActiveDocument.VBProject.VBComponents(1).CodeModule.AddFromString (sCode)
The sCode variable contains another variable sCMDName (txt1.Text). I can
make it work if I leave out the sCMDName and feed the AddFromString method
only string information, but as soon as I add another variable Word give me
the error above and crashes.
Any suggestions would be a help.
Thanks!
on a user form. I can do that sucessfully, but I am unable to add the code to
"ThisDocument" to handle the click event of the newly created button. I am
getting an error that says "the object invoked has disconnected from its
clients". This error occurs on the following line:
ActiveDocument.VBProject.VBComponents(1).CodeModule.AddFromString (sCode)
The sCode variable contains another variable sCMDName (txt1.Text). I can
make it work if I leave out the sCMDName and feed the AddFromString method
only string information, but as soon as I add another variable Word give me
the error above and crashes.
Any suggestions would be a help.
Thanks!