Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Shell function problem (MS Access)

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Shell function problem (MS Access)

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Shell function problem (MS Access)

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Shell function problem (MS Access)

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Shell function problem (MS Access)

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 163
Default Shell function problem (MS Access)

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"
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Shell function problem (MS Access)

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Shell command Andrew Hall NZ Excel Programming 14 December 21st 06 06:27 PM
Shell Problem Stuart[_29_] Excel Programming 1 December 10th 05 12:00 PM
Excel function to search and access database problem Brian K. Sheperd Excel Programming 0 April 20th 05 08:42 PM
Shell function John Keturi Excel Programming 1 May 23rd 04 02:09 AM
Shell function II [email protected] Excel Programming 1 September 19th 03 05:55 PM


All times are GMT +1. The time now is 12:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"