imback2nite
Board Regular
- Joined
- Oct 30, 2004
- Messages
- 211
- Office Version
- 2003 or older
- Platform
- Windows
Hopefully this is an easy one. I have a command button that I want to be able to find a Word document. Now this document will always be in the same place and I’ve been using this code to get to it.
Private Sub CommandButton1_Click()
Dim i As Integer
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
On Error Resume Next
Set wrdDoc = wrdApp.Documents.Open("D:\Documents and Settings\Ken\My Documents\Computer Stuff\dumb_users.doc")
On Error GoTo 0
Set wrdDoc = wrdApp.Documents.Open("E:\Documents and Settings\Ken\My Documents\Computer Stuff\dumb_users.doc")
On Error GoTo 0
End Sub
Here’s the problem. I have this on a Flash Drive and sometimes the Flash is allocated the drive of E: or even F: . Is there a way for the code include looking in Drives all the way to drive G:? I was using a Hyperlink to access the Word document but was having the same problem. Also, is there a way for the code and give an error message reading, “Please Contact” if the file is still not found without giving a Excel error message?
Private Sub CommandButton1_Click()
Dim i As Integer
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
On Error Resume Next
Set wrdDoc = wrdApp.Documents.Open("D:\Documents and Settings\Ken\My Documents\Computer Stuff\dumb_users.doc")
On Error GoTo 0
Set wrdDoc = wrdApp.Documents.Open("E:\Documents and Settings\Ken\My Documents\Computer Stuff\dumb_users.doc")
On Error GoTo 0
End Sub
Here’s the problem. I have this on a Flash Drive and sometimes the Flash is allocated the drive of E: or even F: . Is there a way for the code include looking in Drives all the way to drive G:? I was using a Hyperlink to access the Word document but was having the same problem. Also, is there a way for the code and give an error message reading, “Please Contact” if the file is still not found without giving a Excel error message?