[RESOLVED] Can you "label" sections of a word doc as reference points?
Okay, I don't do much in the way of VBA stuff, so please forgive me if I sound like an idiot (well, more than I normally do :afrog: ).
So I've got this word doc that I am using as a template for program documentation. I also have an xml file that describes each screen. What I would like to do is take the contents of that xml file and match it to different parts of the document. For example..there is a textbox on the first page that is for the title. So I have a <title> tag in the xml and I would like to put its contents into that textbox.
So is there a way for me to tag that textbox as "title", so as I am going through the object model I could do something like...
Code:
document.Fields("title").Select
Selection.TypeText Text:="Some Title"
Is this possible?
:afrog:
Re: Can you "label" sections of a word doc as reference points?
If your txtbox is an ActiveX control, then you can set its name property to anything you like. You can then set its text property as follows. (My example textbox is named "txtTitle")
VB Code:
ThisDocument.txtTitle.Text = "Declan"
Re: Can you "label" sections of a word doc as reference points?
No, this textbox would be of the type found in the Drawing menu in Word. But what I am trying to do is not limited to things like that. I need to be able to define certain areas that will contain certain data. For example...
first Title (text box)
then TOC (table of contents)
then Introduction (free form text)
then Screenshot
etc
and be able to fill in those specific sections with the data that pertains to them.
1 Attachment(s)
Re: Can you "label" sections of a word doc as reference points?
Have you considered using bookmarks? Here's an example where I'm adding 2 pieces of text at pre-defined insertion points.
Re: Can you "label" sections of a word doc as reference points?
I believe that will work just fine. Thanks
:afrog: