"Gavaskar" <nospam@xxxxxx> wrote in message
news:%23JEIlgo%23JHA.4900@xxxxxx
Quote:
> Hello
>
> I'm trying to run a program, lets use mspaint as an example.
>
> I've got mspaint in the folder path
>
> c:\Program Files\Company Name\Version-001\mspaint.exe
> c:\Program Files\Company Name\Version-002\mspaint.exe
> c:\Program Files\Company Name\Version-003\mspaint.exe
>
>
> When I run the script, I query the file mspaint.exe for the version
> number, so I know which one to execute, and I assign that version ID to a
> variable VersionString.
> The returned string will be "Version-001" or "Version-002" or
> "Version-003"
>
>
> My problem is when I do a wshShell.run I'm having problems with the white
> spaces and adding the variable.
>
> Mypath = """c:\Program Files\Company Name\""" & VersionString &
> "\mspaint.exe", 3, False
>
> wshshell.run Mypath, 3, False
>
> I always get a error message that it can not find the specified file
Change your 'Mypath' live to look like this:
Mypath = """c:\Program Files\Company Name\" & VersionString & _
"\mspaint.exe"""
You just needed to move the closing quotes for the command to the end of
'mspaint.exe' and remove the ',3, False' since that is part of your 'Run'
command and not part of the variable assignment.