Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to create a Word 2003 doc from Access 2003

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
We have several reports that are canned. The Company information and other items changes but the wordy part remains mostly unchanged. How can I pass this information from Access to a Word doc? Whats the best way? I would prefer not mail merge it since we need to edit the finished doc.

TIA

DougP, MCP, A+
 
You could create word as an object from Access VBA

Try

Dim oWord as object

set oWord = CreateObject("Word.Application")
oWord.documents.Open "Filename.doc"

'Do all the changes you need

oWord.activedocument.saveas "Filename.doc"
oWord.activedocument.close false
oWord.quit

You can do whatever you need with this

Hope this helps,
sugarflux
 
Thanks
I found this FAQ as well
faq702-2379

I see code referring to bookmarks
.ActiveDocument.Bookmarks("<bookmark name>".Select

Do I need a Word template with bookmarks or?


DougP, MCP, A+
 
Ok great,
I added a bookmark to a sample doc and it works great.
But I can't see the bookmark. Is there a way to show the bookmarks somehow?

DougP, MCP, A+
 
.ActiveWindow.ActivePane.View.ShowAll = True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That doesn't see to do anything.
Code:
   With objWord
       .Visible = True
       .Documents.Open (strDocPath)
       'move to each bookmark, and insert correct text.
       .ActiveDocument.Bookmarks("ProjectNumber").Select
       .Selection.Text = (CStr(Forms!frmReport!txtProjectNumber))
       .ActiveDocument.Bookmarks("WordyStuff").Select
       .Selection.Text = (CStr(Forms!frmReport!txtWordyStuff))

     [COLOR=red] .ActiveWindow.ActivePane.View.ShowAll = True [/color]
   End With
Is there a menu option in Word to show them?

DougP, MCP, A+
 
OOps, sorry:
.ActiveWindow.View.ShowBookmarks = True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ok I guess I was looking for <bookmarkname> or something.
I see a Gray I-beam for each bookmark with no name or anything.

DougP, MCP, A+
 
To see the names:
menu Insert -> Bookmarks ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Can I see the bookmark name in the document where the Gray I beam is? I am going to have a lot of bookmarks in lots of documents. Just thought it would be nice to see the name, like you can see the field name for mail merges if you turn something on.

DougP, MCP, A+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top