Hi,
I have the following bit of code, that enters text into a blank word file when opened.
I also have a form opening up on top of the word document - the form contains a label (whose caption changes depending on the selection in the combo box), a combo box and a button.
I want to know if:
a) Its possible to enter the caption of the label into the open word file when pressing the button
and b) How far off I am (a pointer or two in the right direction would be helpful too!?)?
When I've tried putting the following line into the button's "clicked" procedure, it says Object Missing...
I'm not asking for someone to write it out for me - unless they REALLY want to - as I'm learning as I do it, just not sure what to be looking for.
I have the following bit of code, that enters text into a blank word file when opened.
Code:
Set word_server = CreateObject("Word.Application")
word_server.Caption = "My Document"
word_server.documents.Add , , wdNewBlankDocument, True
word_server.activedocument.PageSetup.Orientation = wdOrientLandscape
word_server.activedocument.PageSetup.TopMargin = 72 '72 points = 1 inch.
word_server.activedocument.PageSetup.BottomMargin = 72
word_server.activedocument.PageSetup.LeftMargin = 36
word_server.activedocument.PageSetup.RightMargin = 36
word_server.activedocument.content.InsertParagraph
word_server.activedocument.content.InsertParagraph
word_server.activedocument.content.Paste 'If you have an image in clipboard
word_server.activedocument.content.InsertParagraphAfter
word_server.activedocument.content.insertafter " My Text Here "
word_server.Visible = True
I also have a form opening up on top of the word document - the form contains a label (whose caption changes depending on the selection in the combo box), a combo box and a button.
I want to know if:
a) Its possible to enter the caption of the label into the open word file when pressing the button
and b) How far off I am (a pointer or two in the right direction would be helpful too!?)?
When I've tried putting the following line into the button's "clicked" procedure, it says Object Missing...
Code:
word_server.activedocument.content.insertafter myTextLabel.Caption
I'm not asking for someone to write it out for me - unless they REALLY want to - as I'm learning as I do it, just not sure what to be looking for.