Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

Create document through code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris - 09 Oct 2006 10:16 GMT
Hi All, sorry to put these 3 questions in 1 but I'm quite new to this.

I'm doing a program in access and the the program does a mail merge through
bookmarks.  The word document is saved and it remains open when another
access form opens up.  On this form, details are edited and there is an
option for add page.

1) How do I add another page onto the existing word document?

From what I can tell, the new page is created through code.

2) how do I create a word document by code?

The company Logo (Jpeg) is brought into the top of the newly created page.

3) How do I get the image and put it on top of the newly created word page?

Again sorry for the lengthy post, but if you can help with any of the above
(even just pointing me in the right direction) I would be very grateful.
Dave Lett - 09 Oct 2006 15:27 GMT
Hi Chris,

1) How do I add another page onto the existing word document?

Dim oRng As Range
Set oRng = ActiveDocument.Range
oRng.Collapse Direction:=wdCollapseEnd
oRng.InsertBreak Type:=wdPageBreak

2) how do I create a word document by code?
Dim oDoc As Document
Set oDoc = Documents.Add _
   (Template:="Normal.dot", _
   DocumentType:=wdNewBlankDocument, _
   Visible:=True)

3) How do I get the image and put it on top of the newly created word page?
Take the company logo, open the template that you want to use for question
2, and manually place it in the location that you want. In this way, every
document that you create based on this template, the logo will be in the
correct location.

HTH,
Dave

> Hi All, sorry to put these 3 questions in 1 but I'm quite new to this.
>
[quoted text clipped - 17 lines]
> above (even just pointing me in the right direction) I would be very
> grateful.
JCNZ - 21 Oct 2006 04:36 GMT
Quick way to add a new page at the end of a doc:

activedocument.Bookmarks("\endofdoc").Range.InsertBefore chr(12)

> Hi All, sorry to put these 3 questions in 1 but I'm quite new to this.
>
[quoted text clipped - 15 lines]
> Again sorry for the lengthy post, but if you can help with any of the above
> (even just pointing me in the right direction) I would be very grateful.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.