Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
J J is offline
external usenet poster
 
Posts: 9
Default Open File with Spaces in Path

Greetings All

I'm having trouble opening files (of any type) which
contain spaces in the path and/or filename. I'd like to be
able to do this. Any help here would be appreciated.

J
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default Open File with Spaces in Path

Enclose the entire "path name\file name" in double quotation marks.

J wrote:
Greetings All

I'm having trouble opening files (of any type) which
contain spaces in the path and/or filename. I'd like to be
able to do this. Any help here would be appreciated.

J

  #3   Report Post  
Posted to microsoft.public.excel.programming
J J is offline
external usenet poster
 
Posts: 9
Default Open File with Spaces in Path

Right now I'm using the following which has double quotes:

Shell "excel C:\Sample Path\Sample File.xls",
vbMaximizedFocus

Please advise, and thanks for your help!

J

-----Original Message-----
Enclose the entire "path name\file name" in double

quotation marks.

J wrote:
Greetings All

I'm having trouble opening files (of any type) which
contain spaces in the path and/or filename. I'd like to

be
able to do this. Any help here would be appreciated.

J

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Open File with Spaces in Path

I'm having the same trouble that you did. I'm using this:

Excelstr = "EXCEL.EXE" + " " + Forms![data import]![Viewer Filename]
Call Shell(Excelstr, 1)

The "Viewer Filename" is a path that has spaces in it and excel cuts off the
path wherever there is a space and tries to open a file. If there are two
spaces in the path, ie C:\Data from Calgary.xls is interpreted as
C:\Data.xls, from.xls, and Calgary.xls. Did you ever figure this out?




"J" wrote:

Right now I'm using the following which has double quotes:

Shell "excel C:\Sample Path\Sample File.xls",
vbMaximizedFocus

Please advise, and thanks for your help!

J

-----Original Message-----
Enclose the entire "path name\file name" in double

quotation marks.

J wrote:
Greetings All

I'm having trouble opening files (of any type) which
contain spaces in the path and/or filename. I'd like to

be
able to do this. Any help here would be appreciated.

J

.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Open File with Spaces in Path

Did you try enclosing in double quotes. If you have quotes enclosed
then you have to double the enclosed quotes.

Another thing to try would be to use %20 instead of the space
for within the pathname.
filename = Replace(filename, " ", "%20")
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"t.roff" wrote in message ...
I'm having the same trouble that you did. I'm using this:

Excelstr = "EXCEL.EXE" + " " + Forms![data import]![Viewer Filename]
Call Shell(Excelstr, 1)

The "Viewer Filename" is a path that has spaces in it and excel cuts off the
path wherever there is a space and tries to open a file. If there are two
spaces in the path, ie C:\Data from Calgary.xls is interpreted as
C:\Data.xls, from.xls, and Calgary.xls. Did you ever figure this out?




"J" wrote:

Right now I'm using the following which has double quotes:

Shell "excel C:\Sample Path\Sample File.xls",
vbMaximizedFocus

Please advise, and thanks for your help!

J

-----Original Message-----
Enclose the entire "path name\file name" in double

quotation marks.

J wrote:
Greetings All

I'm having trouble opening files (of any type) which
contain spaces in the path and/or filename. I'd like to

be
able to do this. Any help here would be appreciated.

J
.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Open File with Spaces in Path

Thanks! I was trying to put double quotations in the code, but what worked
was to put double quotes around the pathname in the form.

"David McRitchie" wrote:

Did you try enclosing in double quotes. If you have quotes enclosed
then you have to double the enclosed quotes.

Another thing to try would be to use %20 instead of the space
for within the pathname.
filename = Replace(filename, " ", "%20")
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"t.roff" wrote in message ...
I'm having the same trouble that you did. I'm using this:

Excelstr = "EXCEL.EXE" + " " + Forms![data import]![Viewer Filename]
Call Shell(Excelstr, 1)

The "Viewer Filename" is a path that has spaces in it and excel cuts off the
path wherever there is a space and tries to open a file. If there are two
spaces in the path, ie C:\Data from Calgary.xls is interpreted as
C:\Data.xls, from.xls, and Calgary.xls. Did you ever figure this out?




"J" wrote:

Right now I'm using the following which has double quotes:

Shell "excel C:\Sample Path\Sample File.xls",
vbMaximizedFocus

Please advise, and thanks for your help!

J

-----Original Message-----
Enclose the entire "path name\file name" in double
quotation marks.

J wrote:
Greetings All

I'm having trouble opening files (of any type) which
contain spaces in the path and/or filename. I'd like to
be
able to do this. Any help here would be appreciated.

J
.





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
my vlookup path changes when I open the file AliGoLightly Excel Worksheet Functions 1 February 23rd 09 09:52 PM
Open Excel file get error with file names that have spaces in the Kozmo Setting up and Configuration of Excel 6 October 29th 08 02:51 AM
File open with Path Name rickey24[_8_] Excel Programming 4 July 8th 04 01:04 AM
How set file open path to filepath of file opened with Explorer ? RandyDtg1 Excel Programming 0 May 14th 04 02:05 AM
Getting the full path when from a File Open Dialog Box Ric Payne Excel Programming 3 July 10th 03 04:58 PM


All times are GMT +1. The time now is 09:08 AM.

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

About Us

"It's about Microsoft Excel"