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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a Word Document 1

Status
Not open for further replies.

99mel

Programmer
Oct 18, 1999
379
GB
Hello,

How can I open Microsoft Word and then open a file in Word through Access.
By just clicking a button I want Word to open a specific document.

Any help much appreciated

Mel
 
If you want Word to run independently of your Access app, use a Shell function:
Shell "C:\Program Files\Microsoft Office\Office\winword.exe ""C:\My Documents\report.doc""", vbNormalFocus

If you want to control Word from Access, you'll need Office 2000 Developer Edition. Add a reference to the Office 9.0 typelib, then use code like the following:
Dim appWord As Word.Application
Set appWord = New Word.Application
From there you just use methods of appWord to open the file and manipulate it.

You can probably do this with Word 97, too, but I believe you'd need an entirely different approach. Rick Sprague
 
The Sendkeys Command may be something to look into, you can send keystrokes to the actice application you are on. I have used it in a macro in combination with runapp. All you have to do is put in the command line of Word (c:\program files\microsoft office\office\winword.exe), then on the next line use your sendkeys command. You will need a ref for the non character keys (Alt, Tab, Esc) I have one if you need it. Good luck.
 
I just do this:

Set FaxDoc = CreateObject("Word.Application")
Set SendFax = FaxDoc.Documents.Add(Template:="PathOfFaxTemplate.dot")
FaxDoc.Visible = True

then if you are going to fill in parts of the template then:

Set Marker = SendFax.Goto(what:=wdGoToBookmark, Name:="TargetName")
Marker.InsertBefore ContactSet.Fields("FirstName").Value & " " & ContactSet.Fields("Surname").Value

Hope this helps

Vince
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top