WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Appending a document to an Active.Document

 
   Home -> Office -> User Forms RSS
Next:  Button Macro for Caclulating in Word Tables  
Author Message
Shezageek

External


Since: Nov 20, 2008
Posts: 2



(Msg. 1) Posted: Thu Nov 20, 2008 7:31 am
Post subject: Appending a document to an Active.Document
Archived from groups: microsoft>public>word>vba>userforms (more info?)

I am creating a form with many TXT boxes and Yes/No questions. Depending on
the yes/no selection from several places, I need to "Append" another document
at the end of the active document. This document is rather large and could
possible end up with approximately 50 pages in it. I have each of the
documents that will be inserted coded to pull in info from the TXT boxes but
I can't get them to insert properly.

Thanks
Back to top
Login to vote
Jean-Guy Marcil

External


Since: Feb 18, 2008
Posts: 393



(Msg. 2) Posted: Thu Nov 20, 2008 9:19 am
Post subject: RE: Appending a document to an Active.Document [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I believe you need to clarify what you are doing as follows:

> I am creating a form with many TXT boxes and Yes/No questions. Depending on
> the yes/no selection from several places, I need to "Append" another document

Will you append only one document, or one per each Yes-No box that is checked?

> at the end of the active document. This document is rather large and could
> possible end up with approximately 50 pages in it. I have each of the

50 pages is not really "large"

> documents that will be inserted coded to pull in info from the TXT boxes but
> I can't get them to insert properly.

What is the content of those TXT box?
How do they relate to the "append" procedure?
What does "I can't get them tio insert properly" mean? What is the problem,
exactly?

What Word version?
Back to top
Login to vote
Shezageek

External


Since: Nov 20, 2008
Posts: 2



(Msg. 3) Posted: Thu Nov 20, 2008 9:29 am
Post subject: RE: Appending a document to an Active.Document [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Jean-Guy Marcil" wrote:

> I believe you need to clarify what you are doing as follows:
>
> > I am creating a form with many TXT boxes and Yes/No questions. Depending on
> > the yes/no selection from several places, I need to "Append" another document
>
> Will you append only one document, or one per each Yes-No box that is checked?

> If the "yes" box is checked, then I want to go to the end of the document, insert a new section and append another document there. There will only be one document appended per each "yes".
> > at the end of the active document. This document is rather large and could
> > possible end up with approximately 50 pages in it. I have each of the
>
> 50 pages is not really "large"
>
> > documents that will be inserted coded to pull in info from the TXT boxes but
> > I can't get them to insert properly.
>
> What is the content of those TXT box?
The txt boxes are name, address, phone, email. . . etc.

> How do they relate to the "append" procedure? There are three questions, If they are answered "yes", then other documents need to be included in the file.

> What does "I can't get them tio insert properly" mean? What is the problem,
> exactly?

I have code that I found to try, however, it doesn't work. Here is a
portion of the form's code.
Private Sub CMDNext1b_Click()

ActiveDocument.Bookmarks("BKacctmgrname").Range = Me.TXTacctmgrname.Value
ActiveDocument.Bookmarks("BKacctmgrcode").Range = Me.TXTacctmgrcode.Value
ActiveDocument.Bookmarks("BKacctmgrphone").Range = Me.TXTacctmgrphone.Value
ActiveDocument.Bookmarks("BKacctmgremail").Range = Me.TXTacctmgremail.Value
ActiveDocument.Bookmarks("BKacctmgrcitystate").Range =
Me.TXTacctmgrcitystate.Value

ActiveDocument.Bookmarks("BKacctmgrasstname").Range =
Me.TXTacctmgrasstname.Value
ActiveDocument.Bookmarks("BKacctmgrasstphone").Range =
Me.TXTacctmgrasstphone.Value
ActiveDocument.Bookmarks("BKacctmgrasstemail").Range =
Me.TXTacctmgrasstemail.Value

Dim strNewBankCust As String

If newbankcustyes_CHK = True Then strNewBankCust = "Yes"
If newbankcustno_CHK = True Then strNewBankCust = "No"


Dim strNewTreasuryCust As String

If CHKnewtreasurymgtyes = True Then strNewTreasuryCust = "Yes"
If CHKnewtreasurymgtno = True Then strNewTreasuryCust = "No"


Dim strTMAuthorization As String

If CHKtmauthorizationyes = True Then strTMAuthorization = "Yes"
If CHKtmauthorizationno = True Then strTMAuthorization = "No"


ActiveDocument.Bookmarks("BKnew_bank_customer").Range.Text =
strNewBankCust
ActiveDocument.Bookmarks("BKnew_treasury_customer").Range.Text =
strNewTreasuryCust
ActiveDocument.Bookmarks("BKtm_authorization").Range.Text =
strTMAuthorization

If CHKtmauthorizationsyes = True Then
ActiveDocument.Bookmarks("EndOfDoc").Range.InsertBreak
wdSectionBreakNextPage
ActiveDocument.Bookmarks("EndOfDoc").Range.InsertFile
("c:\rbcdocs\tmauthorization.doc")
End If

If CHKtmauthorizationsyes = True Then
ActiveDocument.Bookmarks("EndOfDoc").Range.InsertBreak
wdSectionBreakNextPage
ActiveDocument.Bookmarks("EndOfDoc").Range.InsertFile
("c:\rbcdocs\tmtermsconditions.doc")
End If

frmUserForm1b.Hide
frmUserForm2.Show

End Sub
>
> What Word version? Word 2003.
>
Back to top
Login to vote
Jean-Guy Marcil

External


Since: Feb 18, 2008
Posts: 393



(Msg. 4) Posted: Fri Nov 21, 2008 11:04 am
Post subject: RE: Appending a document to an Active.Document [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Shezageek" wrote:

> > I believe you need to clarify what you are doing as follows:
> >
> > > I am creating a form with many TXT boxes and Yes/No questions. Depending on
> > > the yes/no selection from several places, I need to "Append" another document
> >
> > Will you append only one document, or one per each Yes-No box that is checked?
>
> If the "yes" box is checked, then I want to go to the end of the document, insert a new section and append another document there. There will only be one document appended per each "yes".
> > > at the end of the active document. This document is rather large and could
> > > possible end up with approximately 50 pages in it. I have each of the
> >
> > 50 pages is not really "large"
> >
> > > documents that will be inserted coded to pull in info from the TXT boxes but
> > > I can't get them to insert properly.
> >
> > What is the content of those TXT box?
> The txt boxes are name, address, phone, email. . . etc.
>
> > How do they relate to the "append" procedure? There are three questions, If they are answered "yes", then other documents need to be included in the file.
>
> > What does "I can't get them tio insert properly" mean? What is the problem,
> > exactly?
>
> I have code that I found to try, however, it doesn't work. Here is a
> portion of the form's code.

Just in order to help you help yourself, when you run code and run into
problems, you have to explain what your expectations for the code were and
the observed results. Of course, explaining what you did to achieve the
expectations is also important.

Here, you explained your expectations and what you did (the code you just
posted), but never explained the observed results. The first time you wrote
"It does not work properly" and the second time you wrote "It does not
work." Neither of which are very helpful.

By looking at your code, I suspect you were getting an error message. it is
also very helpful to mention those and post the error message text.

Try this:
Change the code
ActiveDocument.Bookmarks("EndOfDoc").Range
to
ActiveDocument.Bookmarks("\EndOfDoc").Range

The predefined bookmarks have to be prefixed by a "\".

Does that help?

> Private Sub CMDNext1b_Click()
>
> ActiveDocument.Bookmarks("BKacctmgrname").Range = Me.TXTacctmgrname.Value
> ActiveDocument.Bookmarks("BKacctmgrcode").Range = Me.TXTacctmgrcode.Value
> ActiveDocument.Bookmarks("BKacctmgrphone").Range = Me.TXTacctmgrphone.Value
> ActiveDocument.Bookmarks("BKacctmgremail").Range = Me.TXTacctmgremail.Value
> ActiveDocument.Bookmarks("BKacctmgrcitystate").Range =
> Me.TXTacctmgrcitystate.Value
>
> ActiveDocument.Bookmarks("BKacctmgrasstname").Range =
> Me.TXTacctmgrasstname.Value
> ActiveDocument.Bookmarks("BKacctmgrasstphone").Range =
> Me.TXTacctmgrasstphone.Value
> ActiveDocument.Bookmarks("BKacctmgrasstemail").Range =
> Me.TXTacctmgrasstemail.Value
>
> Dim strNewBankCust As String
>
> If newbankcustyes_CHK = True Then strNewBankCust = "Yes"
> If newbankcustno_CHK = True Then strNewBankCust = "No"
>
>
> Dim strNewTreasuryCust As String
>
> If CHKnewtreasurymgtyes = True Then strNewTreasuryCust = "Yes"
> If CHKnewtreasurymgtno = True Then strNewTreasuryCust = "No"
>
>
> Dim strTMAuthorization As String
>
> If CHKtmauthorizationyes = True Then strTMAuthorization = "Yes"
> If CHKtmauthorizationno = True Then strTMAuthorization = "No"
>
>
> ActiveDocument.Bookmarks("BKnew_bank_customer").Range.Text =
> strNewBankCust
> ActiveDocument.Bookmarks("BKnew_treasury_customer").Range.Text =
> strNewTreasuryCust
> ActiveDocument.Bookmarks("BKtm_authorization").Range.Text =
> strTMAuthorization
>
> If CHKtmauthorizationsyes = True Then
> ActiveDocument.Bookmarks("EndOfDoc").Range.InsertBreak
> wdSectionBreakNextPage
> ActiveDocument.Bookmarks("EndOfDoc").Range.InsertFile
> ("c:\rbcdocs\tmauthorization.doc")
> End If
>
> If CHKtmauthorizationsyes = True Then
> ActiveDocument.Bookmarks("EndOfDoc").Range.InsertBreak
> wdSectionBreakNextPage
> ActiveDocument.Bookmarks("EndOfDoc").Range.InsertFile
> ("c:\rbcdocs\tmtermsconditions.doc")
> End If
>
> frmUserForm1b.Hide
> frmUserForm2.Show
>
> End Sub
> >
> > What Word version? Word 2003.
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> User Forms All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET |
  • IT Support