Open Word + Document using a button? (1 Viewer)

TidusBlade

Watermelon Knight
Local time
Today, 21:41
Joined
Jan 26, 2009
Messages
6
I was wondering if it's possible to a button with VB code that opens up Microsoft Word with a document already sitting there, so the button always opens up Word and the same document? I tried googling and the only solution I found was opening Word only.

I was thinking if it's possible to let VB send some sort of signal to Windows and tells it to handle file x, which it will open with Word, much like clicking on the document itself in Explorer.

Really stuck on this one, so any help would be appreciated :)
Thanks!
 

DCrake

Remembered
Local time
Today, 18:41
Joined
Jun 8, 2005
Messages
8,632
There are many examples of doing so here. You simply need to pass the name of the file you want to open as an argument.
 

missinglinq

AWF VIP
Local time
Today, 13:41
Joined
Jun 20, 2003
Messages
6,423
You need to use Shell() to do this. Here's an example that loads Word 2003 and opens a document named AccessTips.doc in the folder C:\Appointmentbook\tips.

Code:
Call Shell("C:\program files\Microsoft Office\Office11\winword.exe C:\Appointmentbook\tips\AccessTips.doc", 1)

You will have to substitute the actual path to your copy/version of Word as well as the path/filename for your document.
 

Ed in Aus

Registered User.
Local time
Tomorrow, 03:41
Joined
Oct 21, 2008
Messages
14
Hi I am having trouble getting this to work I have check the path for word.

I think it is because I have gaps in the file path.
Code:
Call Shell("V:\Program Files (x86)\Microsoft Office\OFFICE11\WINWORD.EXE  L:\Best Practice Manual\Full Labour Hire Best Practice Manual.doc", 1)
 
Last edited:

Users who are viewing this thread

Top Bottom