Open a Doc with VBA

katekaew

Registered User.
Local time
Today, 08:32
Joined
Jan 19, 2005
Messages
19
I have a list box contained the subjects, a button to click when a particular subject has been selected.
On_click(), this button will call Microsoft-Word which will open a particular MS-Word file. Each user can see and manage only their file.
How to write the VBA code to manipulate this task?
 
Last edited:
I forgot to say that each user can see and manage only their file. I tried the following code:

Private Sub cmdReview_Click()
Call Get_User() 'To check if the particular user has a permission to review this file

'Open doc
Dim objWD As Word.Application
On Error GoTo Files_Click_Err
Set objWD = CreateObject("Word.Application")
objWD.Documents.Open ("F:\Assessment\01.doc")
objWD.visible = True

Set objWD = Nothing

Files_Click_Exit:
Exit Sub

Files_Click_Err:
MsgBox Err.Number & " - " & Err.Description
Resume Files_Click_Exit
End Sub

When Word has been loaded there is a dialog box said that it's opened by myself already. See attached.
 

Attachments

  • File_in_use.JPG
    File_in_use.JPG
    16.3 KB · Views: 160
Last edited:
you can try opening the file by

Application.FollowHyperlink "FileNamePathGoesHere"
 

Users who are viewing this thread

Back
Top Bottom