Open a Word file from a Form

racdata

Registered User.
Local time
Today, 07:29
Joined
Oct 30, 2002
Messages
74
Hi all
I need to run a certain file from the form
I create a button as follows
Select in the categories "Applications" then select "Run Ms Word"
I have tested it and it open Word but not even a blank page
I then open the code as seen below and want to insert the filename but do not know where. Can someone please help me?

Private Sub Command35_Click()
On Error GoTo Err_Command35_Click

Dim oApp As Object

Set oApp = CreateObject("Word.Application")
oApp.Visible = True

Exit_Command35_Click:
Exit Sub

Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click

End Sub

The file is - D:\Panelbeaters\Pb Manual.doc
 
What about:

Code:
Dim oApp As Object
    Set oApp = CreateObject("Word.Application")
    oApp.Visible = True
    AppActivate oApp
    oApp.Documents.Open FileName:=FilLoc & "D:\Panelbeaters\Pb Manual.doc", readonly:=readonly
    Set oApp = Nothing
 
Thanx

I thank you Uncle Gizmo it works perfectly

Ye I'm learning every time I open this site
 

Users who are viewing this thread

Back
Top Bottom