Isaac
Lifelong Learner
- Local time
- Today, 10:27
- Joined
- Mar 14, 2017
- Messages
- 10,006
I'll admit I'm using VBScript, but am posting this in this forum because ... I know a lot of people use Access VBA to run out a wscript.shell line of code anyway, so hope you'll forgive me on that.
So, in VBScript, simply trying to shell open a file - as if the user had double clicked on it.
I saw this example:
But I have a variable path, so I have to pass in the variable. (And it might include spaces).
I figured OK, one out of those 3 double quotes, is the quote for the literal string. If I pass in a String variable, I can lose those. Which leaves two.
When I did this:
... the result was no error, but, as soon as the VBScript runs, it opens the This PC window (!?!?) Cannot explain that one ......
Anyway, what's the correct syntax to pass in, given that I have a string variable, which is a full path to an accdr file, and it might have spaces.
Thanks for looking!
So, in VBScript, simply trying to shell open a file - as if the user had double clicked on it.
I saw this example:
(note there are 3 double quotes on either side of that path).CreateObject("WScript.Shell").Run("""C:\Program Files\my_html_files\file.htm""")
But I have a variable path, so I have to pass in the variable. (And it might include spaces).
I figured OK, one out of those 3 double quotes, is the quote for the literal string. If I pass in a String variable, I can lose those. Which leaves two.
When I did this:
Code:
dim strRun
strRun = chr(34) & chr(34) & strFullPathToDatabaseFolder & "\Reconciliation_fe.accdr" & chr(34) & chr(34)
CreateObject("WScript.Shell").Run(strRun)
Anyway, what's the correct syntax to pass in, given that I have a string variable, which is a full path to an accdr file, and it might have spaces.
Thanks for looking!