Reputation: 231
Hi Im tryijng to open a local htm file ussing vb script. I have the following code which will work for standard online webpages however my target htm is found localy, and in that case senario i cant get it to work
WORKING:
strURL = "http://www.somesite.com"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run(strURL)
NOT WORKING:
strURL = "file://J:\Project Phoenix\Tekenafspraak Tafelhandboek\COMPELATION WITHOUT IMAGES (MASTER)\Tekenafspraak Tafelhandboek.htm"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run(strURL)
Upvotes: 0
Views: 79
Reputation: 28
You need to put quotes around your full path name if there are spaces in it. In this case, it means adding two extra double-quotes at the beginning and end of your string.
And you shouldn't need the "file://" in the path. The Shell object will just open the htm file in your default browser automatically:
strURL = """J:\Project Phoenix\Tekenafspraak Tafelhandboek\COMPELATION WITHOUT IMAGES (MASTER)\Tekenafspraak Tafelhandboek.htm"""
Set objShell = CreateObject("Wscript.Shell")
objShell.Run(strURL)
Upvotes: 1
Reputation: 146
Quote your spaces. This is spaces 101. What will happen in your script will depend on the configuration of the computer it is run on.
Upvotes: 0