How do you open a file path that is displayed in a textbox inside a word document?
So far I have the code working to click on a button that opens up a browse function. In here you select the file you want. This populates a textbox with the path to that file.
Private Sub cmdBrowse_Click()
'Dim strNewFile As String
On Error GoTo Browse_Err
With Me.cdlgOpen
'You should only use one of the next two lines if you want to open to either a default file or folder
'.FileName = EXISTINGFILE 'Comment out if you don't want to open to a default file
.InitDir = ESIXTINGDIR 'Comment out if you don't want to open to a default folder
.CancelError = True
.Filter = "Word Files (*.doc)|*.doc|"
.ShowSave
strNewFile = .FileName
End With
Browse_Exit:
Me.resume = strNewFile
Me.resume.IsHyperlink = True
Exit Sub
Browse_Err:
If Err.Number = 32755 Then
Resume Browse_Exit
Else
MsgBox Err.Number & ": " & Err.description
Resume Browse_Exit
End If
End Sub
And then I have an on click command that would open the file in the MSWord application whenever a user clicks on the textbox containing the file path
Here is what I have so far:
Private Sub resume_Click()
Dim stAppName As String
stAppName = "C:\Program Files\Microsoft Office\Office\Winword.exe "
Call Shell(stAppName, 1)
End Sub
But that only launches the program
Thanks for your help in advance! RSchultz
rschultz@fivestardev.com
**Access 2000**
So far I have the code working to click on a button that opens up a browse function. In here you select the file you want. This populates a textbox with the path to that file.
Private Sub cmdBrowse_Click()
'Dim strNewFile As String
On Error GoTo Browse_Err
With Me.cdlgOpen
'You should only use one of the next two lines if you want to open to either a default file or folder
'.FileName = EXISTINGFILE 'Comment out if you don't want to open to a default file
.InitDir = ESIXTINGDIR 'Comment out if you don't want to open to a default folder
.CancelError = True
.Filter = "Word Files (*.doc)|*.doc|"
.ShowSave
strNewFile = .FileName
End With
Browse_Exit:
Me.resume = strNewFile
Me.resume.IsHyperlink = True
Exit Sub
Browse_Err:
If Err.Number = 32755 Then
Resume Browse_Exit
Else
MsgBox Err.Number & ": " & Err.description
Resume Browse_Exit
End If
End Sub
And then I have an on click command that would open the file in the MSWord application whenever a user clicks on the textbox containing the file path
Here is what I have so far:
Private Sub resume_Click()
Dim stAppName As String
stAppName = "C:\Program Files\Microsoft Office\Office\Winword.exe "
Call Shell(stAppName, 1)
End Sub
But that only launches the program
Thanks for your help in advance! RSchultz
rschultz@fivestardev.com
**Access 2000**