Howdy,
I'm in the process of building a user form that required the user to brows for a file, the path of the file that they select is then displayed in the textbox next to the "browse" button in my form. I also have another button next to this which when selected will open the file that is displayed in the textbox previously mentioned.
I’ve been trying the shell command but with no success, I can get the user form to open adobe reader but whenever I try to include that file path for which to open the file I keep getting runtime errors, can anyone help.
Below are a couple of examples that I’ve tried (you'll prob be able to guess from the code that I’m very new to VB in excel).
For additional info the value in the textbox would be something like, "H:\My Documents\PDF Files\myfile.pdf"
Dim GetFile As String
Shell "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe", vbNormalFocus
'this opens adobe reader but I'm trying to open a specific file
Shell "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" & textbox9.value, vbNormalFocus
This produces the runtime error again
Dim GetFile As String
GetFile = TextBox9.Value
Shell "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" & GetFile, vbNormalFocus
'this produced a runtime error - to be honest this was an attempt born out of frustration.
Any help would be greatly appreciated.
Thanks in advance
G
I'm in the process of building a user form that required the user to brows for a file, the path of the file that they select is then displayed in the textbox next to the "browse" button in my form. I also have another button next to this which when selected will open the file that is displayed in the textbox previously mentioned.
I’ve been trying the shell command but with no success, I can get the user form to open adobe reader but whenever I try to include that file path for which to open the file I keep getting runtime errors, can anyone help.
Below are a couple of examples that I’ve tried (you'll prob be able to guess from the code that I’m very new to VB in excel).
For additional info the value in the textbox would be something like, "H:\My Documents\PDF Files\myfile.pdf"
Dim GetFile As String
Shell "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe", vbNormalFocus
'this opens adobe reader but I'm trying to open a specific file
Shell "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" & textbox9.value, vbNormalFocus
This produces the runtime error again
Dim GetFile As String
GetFile = TextBox9.Value
Shell "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" & GetFile, vbNormalFocus
'this produced a runtime error - to be honest this was an attempt born out of frustration.
Any help would be greatly appreciated.
Thanks in advance
G