Home > Archive > Visual Basic > November 2004 > problem with fileopen
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
problem with fileopen
|
|
| A-Design 2004-11-22, 3:55 am |
| Hi,
Can anyone please tell me why this code is working:
fileopen = Shell("C:\Program Files\EC55\ec55.exe " & "c:\04987.ecw", 4)
and this code is not:
dim directory as string
directory = "c:\04987.ecw"
fileopen = Shell("C:\Program Files\EC55\ec55.exe " & "directory", 4)
They both open the application, the first one open the file also, but the
second one doesn't.
Thanks,
Afshin
| |
| Gaurav - http://www.gauravcreations.com 2004-11-22, 8:55 am |
| remove the double quotes from directory since it is a variable and not a string
--
Gaurav Creations
"A-Design" wrote:
> Hi,
> Can anyone please tell me why this code is working:
>
> fileopen = Shell("C:\Program Files\EC55\ec55.exe " & "c:\04987.ecw", 4)
>
> and this code is not:
>
> dim directory as string
> directory = "c:\04987.ecw"
> fileopen = Shell("C:\Program Files\EC55\ec55.exe " & "directory", 4)
>
> They both open the application, the first one open the file also, but the
> second one doesn't.
>
> Thanks,
> Afshin
>
>
>
| |
| NickHK 2004-11-22, 8:55 am |
| Afshin,
What do you get if you run this line of code ?
Debug.Print "C:\Program Files\EC55\ec55.exe " & "directory"
NickHK
"A-Design" <afshinstock@hotmail.com> wrote in message
news:#ZVzaKG0EHA.3820@TK2MSFTNGP11.phx.gbl...
> Hi,
> Can anyone please tell me why this code is working:
>
> fileopen = Shell("C:\Program Files\EC55\ec55.exe " & "c:\04987.ecw", 4)
>
> and this code is not:
>
> dim directory as string
> directory = "c:\04987.ecw"
> fileopen = Shell("C:\Program Files\EC55\ec55.exe " & "directory", 4)
>
> They both open the application, the first one open the file also, but the
> second one doesn't.
>
> Thanks,
> Afshin
>
>
| |
| Reetesh B. Chhatpar 2004-11-27, 3:55 pm |
| Hi,
"c:\04987.ecw" is the parameter I guess you are passing to the ec55.exe.
Please prefix the parameter with a single space like " c:\04987.ecw"
I hope this helps !
Reetesh B. Chhatpar
ShawMan Software Enterprises
www.shawmansoftware.com
Diamond is just another piece of coal that did well under pressure.
"A-Design" <afshinstock@hotmail.com> wrote in message
news:%23ZVzaKG0EHA.3820@TK2MSFTNGP11.phx.gbl...
> Hi,
> Can anyone please tell me why this code is working:
>
> fileopen = Shell("C:\Program Files\EC55\ec55.exe " & "c:\04987.ecw", 4)
>
> and this code is not:
>
> dim directory as string
> directory = "c:\04987.ecw"
> fileopen = Shell("C:\Program Files\EC55\ec55.exe " & "directory", 4)
>
> They both open the application, the first one open the file also, but the
> second one doesn't.
>
> Thanks,
> Afshin
>
>
| |
| Douglas J. Steele 2004-11-29, 3:56 pm |
| Unfortunately, that's not the correct answer, Reetesh. The blank is there
(after C:\Program Files\EC55\ec55.exe). The problem is that the word
directory is enclosed in quotes, so that the Shell command is trying to use
the literal "directory", rather than the contents of the variable.
To make it work, you need to use:
dim directory as string
directory = "c:\04987.ecw"
fileopen = Shell("C:\Program Files\EC55\ec55.exe " & directory, 4)
In the event that the content of directory might include spaces, the
following would be better:
dim directory as string
directory = "c:\04987.ecw"
fileopen = Shell("C:\Program Files\EC55\ec55.exe " & Chr(34) & directory
& Chr$(34), 4)
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Reetesh B. Chhatpar" <reetesh@widesystems.com> wrote in message
news:cnsidd$58i1@news-auh.emirates.net.ae...
> Hi,
>
> "c:\04987.ecw" is the parameter I guess you are passing to the ec55.exe.
> Please prefix the parameter with a single space like " c:\04987.ecw"
>
> I hope this helps !
>
> Reetesh B. Chhatpar
> ShawMan Software Enterprises
> www.shawmansoftware.com
>
> Diamond is just another piece of coal that did well under pressure.
>
>
> "A-Design" <afshinstock@hotmail.com> wrote in message
> news:%23ZVzaKG0EHA.3820@TK2MSFTNGP11.phx.gbl...
4)[color=darkred]
the[color=darkred]
>
>
|
|
|
|
|