Open a Word document over a network from a commnad button on a for

G

Guest

Hi I am trying to do what the subject line states over an internal network.
I am using Access 2002 and from the form command button I have created using
the mini wizard the VB code ends up like so (with
some subsituted path names):

Private Sub Open_LAN_ID_Tech_Request___How_Do_I_Click()
On Error GoTo Err_Open_LAN_ID_Tech_Request___How_Do_I_Click

Dim stAppName As String

stAppName = "Winword.exe \\servername\highlevel folder\group
folder\database folder\Working Progress\LAN ID Tech Request - How Do I.doc"
Call Shell(stAppName, 1)

Exit_Open_LAN_ID_Tech_Request___How_Do_I:
Exit Sub

Err_Open_LAN_ID_Tech_Request___How_Do_I_Click:
MsgBox Err.Description
Resume Exit_Open_LAN_ID_Tech_Request___How_Do_I

End Sub

I am a complete noobie when it comes to VB coding and the error message I
get from Word is:
The document or path name is not vaild. Try these suggestions.
* Check the file permissions for the document or drive.
* Use the file open dialog box top locate the document.
(C:\Documents and Settings\mylanid\...\ID)


Firstly is it actually possible to open an Office document over a network
from an Access command button??

Secondly, if it is possibly where am I going wrong with the command/string?
I do have access/permissions to the drive and document I am trying to open.

Your help is much appreciated.
Cheers Venia
 
D

Douglas J. Steele

Since your file name has embedded blanks in it, you must put quotes around
the file.

To include quotes in the midst of a text string in VBA, you need to double
the quotes:

stAppName = "Winword.exe ""\\servername\highlevel folder\group
folder\database folder\Working Progress\LAN ID Tech Request - How Do
I.doc"""

(note that that's 3 double quotes at the end)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top