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

Using a Word Macro in Access....is this possible?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello experts,
I am doing a Microsoft Access system for my uncle (he runs a small estate agents) - I have practically finished the system itself, and it works perfectly. There is one more feature that I think would be a very nice touch to the system, that is linking individual sections of the Access system to relevant sections in my user guide done that I created on Microsoft Word, in order to make an "online help system" so that he wouldnt have to dig out a hard copy of the User Guide every time he gets stuck. I already worked out how to make the bookmarks on the User Guide in Word, and create a macro to go to that bookmark. What i need to do now is somehow make a macro in Access that i can attach to a button that would open Word and run the macro that scrolls to the specified bookmark.
(I am using Microsoft Access 2000, and Microsoft Word 2000 BTW :)

Thanks a lot in advanced (I apologise if this has been raised before, I am very new to this forum :),

Andrew Whiteoak
 
As far as I can remember, the command in access would be :

Shell &quot;c:\<path of word>\winword.exe c:\<path of doc>\doc.doc /m<Name of macro>&quot;

This was using Access 2 with Word 95 - but I see no reason why it shouldn't still work.

- Fez
 
If you add a reference to the Word Object Library you can get at full Word Automation.

You can open the document if it is not already open using GetObject/CreateObject, and then flip to the pages that you want to show.
 
Wouldn't using hyperlinks be better? You can use a hyperlink in a control button on your form.
 
Thanks for the responses guys :) Sorry for asking, Hellferret(I really arent too good with advanced features), but how would I go about accessing the Shell so I could type in that command line? I looked on the macro list and i cannot see any command there...
Also, how would i go about adding a reference to the &quot;Word Object Library&quot; if i were to take that approach?

Are these too options hard to implement?

Thanks,
Andrew W
 
In VBA you can use:

Shell &quot;c:\<path of word>\winword.exe c:\<path of doc>\doc.doc /m<Name of macro>&quot;

This is all you need. If using macros then put the below code in a module and use 'RunCode <functionname>' from the macro.

Function <functionname>()

Shell &quot;c:\<path of word>\winword.exe c:\<path of doc>\doc.doc /m<Name of macro>&quot;

End Function





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top