Create document through code

C

Chris

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.
 
D

Dave Lett

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
 
J

JCNZ

Quick way to add a new page at the end of a doc:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top