J
Jason Logue
Sub CommandButton1_Click()
Hi, I have posted this question before, but I think my posting was too
long and convoluted. Okay, a user is filling out a template in Word
by using automated userforms. On the third userform to appear, there
are four added command buttons that open a window with a list of
Chapter numbers (27 chapters). The user clicks a chapter command
button and access the another window with a list of all the sections
in that chapter (these sections are bookmarked in the chapter
documents). The user then clicks on a section button and that
information populates the corresponding textbox, which can then be
edited by the user and eventually populates the template form.
Because there are four textboxes, I had to repeat the code for each
different textbox. As you can imagine, this too long time. Below I
have put pound signs where the changing variables are located. The
code that pulls the bookmarked information into the template is the
same, except that the textboxes change each time. Right now I have
over a 100 userforms. This is causing my template size to get rather
large, and I am concerned for problems later. I am sure ther is an
easier way to do this, but since I am a newbie, I am not sure how.
I'd appreciate any help. One person suggested using Autotext, but I
am not sure how that fits into this.
Sub CommandButton1()
Dim i As Integer, source As Document
Set source = Documents.Open("C:\Documents and
Settings\Logue\My Documents\Allied
Title\exceptions\chapter#(chapters 1-27).doc")
For i = 1 To source.Bookmarks.Count
Userform3.TextBox*.Text = source.Bookmarks(# (this depends on how
many bookmarks are in that particular document)).Range
- This selects the first bookmark in chapter one. and
inserts the info in Textbox8.
Next i
Documents("C:\Documents and Settings\Logue\My
Documents\Allied Title\exceptions\Chapterone.doc").Close
SaveChanges = False
End Sub
-TIA,
Jason
Hi, I have posted this question before, but I think my posting was too
long and convoluted. Okay, a user is filling out a template in Word
by using automated userforms. On the third userform to appear, there
are four added command buttons that open a window with a list of
Chapter numbers (27 chapters). The user clicks a chapter command
button and access the another window with a list of all the sections
in that chapter (these sections are bookmarked in the chapter
documents). The user then clicks on a section button and that
information populates the corresponding textbox, which can then be
edited by the user and eventually populates the template form.
Because there are four textboxes, I had to repeat the code for each
different textbox. As you can imagine, this too long time. Below I
have put pound signs where the changing variables are located. The
code that pulls the bookmarked information into the template is the
same, except that the textboxes change each time. Right now I have
over a 100 userforms. This is causing my template size to get rather
large, and I am concerned for problems later. I am sure ther is an
easier way to do this, but since I am a newbie, I am not sure how.
I'd appreciate any help. One person suggested using Autotext, but I
am not sure how that fits into this.
Sub CommandButton1()
Dim i As Integer, source As Document
Set source = Documents.Open("C:\Documents and
Settings\Logue\My Documents\Allied
Title\exceptions\chapter#(chapters 1-27).doc")
For i = 1 To source.Bookmarks.Count
Userform3.TextBox*.Text = source.Bookmarks(# (this depends on how
many bookmarks are in that particular document)).Range
- This selects the first bookmark in chapter one. and
inserts the info in Textbox8.
Next i
Documents("C:\Documents and Settings\Logue\My
Documents\Allied Title\exceptions\Chapterone.doc").Close
SaveChanges = False
End Sub
-TIA,
Jason