Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Trying to do this within Excel VBA but having a problem with the following shell command. The command line switch can't open the named file. Dim retVal retVal = Shell("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE S:\My Folder\MyFile.mdb", 1) The problem stems, I assume, from the space in the pathname (something over which I have no control) Is there a known solution to this issue or is there a more correct way to type the pathname and filename to overcome the problem. i've tried several combinations of parentheses with no luck Any help appreciated Michael Bond |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Trying to do this within Excel VBA but having a problem with the following
shell command. The command line switch can't open the named file. Dim retVal retVal = Shell("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE S:\My Folder\MyFile.mdb", 1) The problem stems, I assume, from the space in the pathname (something over which I have no control) Give this a try... retVal = Shell("""C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"" ""S:\My Folder\MyFile.mdb""", 1) Rick |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Michael,
Try enclosing the path and filename with double quotes. like this: retVal = Shell("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE ""S:\My Folder\MyFile.mdb""", 1) -- Hope that helps. Vergel Adriano "mabond" wrote: Hi Trying to do this within Excel VBA but having a problem with the following shell command. The command line switch can't open the named file. Dim retVal retVal = Shell("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE S:\My Folder\MyFile.mdb", 1) The problem stems, I assume, from the space in the pathname (something over which I have no control) Is there a known solution to this issue or is there a more correct way to type the pathname and filename to overcome the problem. i've tried several combinations of parentheses with no luck Any help appreciated Michael Bond |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Michael,
strTmp = "C:\Program Files\Microsoft Office\Office\" strtmp = strtmp & "MSACCESS.EXE S:\My Folder\MyFile.mdb" strtmp = chr(34) & strtmp & chr(34) retVal = Shell(strtmp, 1) -- Helmut Weber Win XP, Office 2003 "red.sys" & Chr$(64) & "t-online.de" |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rick
thanks, worked a treat...that was one combination I didn't try! Appreciate the help and spead of response. Regards Michael Bond "Rick Rothstein (MVP - VB)" wrote: Trying to do this within Excel VBA but having a problem with the following shell command. The command line switch can't open the named file. Dim retVal retVal = Shell("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE S:\My Folder\MyFile.mdb", 1) The problem stems, I assume, from the space in the pathname (something over which I have no control) Give this a try... retVal = Shell("""C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"" ""S:\My Folder\MyFile.mdb""", 1) Rick |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Vergel
Appreciate the help. Got it working now. Regards Michael Bond "Vergel Adriano" wrote: Michael, Try enclosing the path and filename with double quotes. like this: retVal = Shell("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE ""S:\My Folder\MyFile.mdb""", 1) -- Hope that helps. Vergel Adriano "mabond" wrote: Hi Trying to do this within Excel VBA but having a problem with the following shell command. The command line switch can't open the named file. Dim retVal retVal = Shell("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE S:\My Folder\MyFile.mdb", 1) The problem stems, I assume, from the space in the pathname (something over which I have no control) Is there a known solution to this issue or is there a more correct way to type the pathname and filename to overcome the problem. i've tried several combinations of parentheses with no luck Any help appreciated Michael Bond |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Helmut
Thanks Michael "Helmut Weber" wrote: Hi Michael, strTmp = "C:\Program Files\Microsoft Office\Office\" strtmp = strtmp & "MSACCESS.EXE S:\My Folder\MyFile.mdb" strtmp = chr(34) & strtmp & chr(34) retVal = Shell(strtmp, 1) -- Helmut Weber Win XP, Office 2003 "red.sys" & Chr$(64) & "t-online.de" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problem with Shell command | Excel Programming | |||
Shell Problem | Excel Programming | |||
Excel function to search and access database problem | Excel Programming | |||
Shell function | Excel Programming | |||
Shell function II | Excel Programming |