Shell with filename as variable 
Author Message
 Shell with filename as variable

I would like to use the shell command to open a certain file in notepad.  I
have figured out how to open notepad and a file using:

Shell ("c:\windows\Notepad.exe d:\foo.txt")

but the problem is that the filename may change and is specified in a variable
called "filename".  I need to have notepad open with whatever string is
contained in the "filename" variable.

Thanks,
Jeff



Thu, 28 Dec 2000 03:00:00 GMT  
 Shell with filename as variable
Try  (If filename is dimensioned as a string):
x% = Shell ("c:\windows\Notepad.exe " + filename)

Be sure a space is after exe and ".



Thu, 28 Dec 2000 03:00:00 GMT  
 Shell with filename as variable
Works like a charm!!  The key to the whole thing is the space after the .exe

I was doing everything but that.  BTW,  the & sign will also work.

Thanks much,

Jeff


Quote:

>Try  (If filename is dimensioned as a string):
>x% = Shell ("c:\windows\Notepad.exe " + filename)

>Be sure a space is after exe and ".



Thu, 28 Dec 2000 03:00:00 GMT  
 Shell with filename as variable
        Shell ("c:\windows\Notepad.exe " & filename)

Don't forget to include the blank space after the .exe.

Lee Weiner
weiner AT fuse DOT net



Quote:

>I would like to use the shell command to open a certain file in notepad.  I
>have figured out how to open notepad and a file using:

>Shell ("c:\windows\Notepad.exe d:\foo.txt")

>but the problem is that the filename may change and is specified in a variable
>called "filename".  I need to have notepad open with whatever string is
>contained in the "filename" variable.

>Thanks,
>Jeff



Thu, 28 Dec 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. valid filenames for shell functions?

2. Shell command and long filenames

3. Passing drive\dir\filename params to a DOS program via SHELL

4. Shell and DOS Filenames

5. shell with long filename as param?

6. Filename longer than one word with shell command

7. Help with long filenames and the shell command.

8. Word 97 save variable filename help

9. Open FileName$ for Input As #Variable....Help!

10. Documents.Open FileName variable?

11. assigning certain filename to a variable

12. Word 97 save variable filename help

 

 
Powered by phpBB® Forum Software