Opening Word Document from within Access

  • Thread starter Thread starter joemosier
  • Start date Start date
J

joemosier

I have an Access database. From within Access, -I need to
open a Word document for a merge. I have no trouble
opening Word with the Shell and AppActivate command. I
have tried to Open the document I want by using SendKeys
but have run into a stone wall. I can send characters
using Sendkeys. I cannot get it to accept either
Control "O" or Control "F12" to open the Open dialog box.

ANybody got any suggestions?

THanks.
 
If you want to control what Word does, do not start it with shell() &
control it with sendkeys. Instead, start it with createobject(), and use
methods of the Word "object model" to control what it does. This is called,
controlling another program via "automation". For example:

(untested)

dim oWord as object
set oWord = createobject ("word.application")
oWord.visible = true
oWord.documents.add "C:\My document.doc"

The last line might not be quite right - but you see what I mean.

HTH,
TC
 
Back
Top