Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Opening a file with a space in the name?

This line works...

Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")

this one returns a 1004 error...

Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")

getting "smart" I tried...

Set working = Workbooks.Open("""L:\theFolder\The Email.xls""")

The file in question WILL have a space in the name when we receive it. Is
there some trick to opening the file when there's a space in the name?

Maury
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Opening a file with a space in the name?

You must have misspelled the name (maybe it has two spaces).

This worked fine for me (demo'd from the immediate window)

set wkbk = Workbooks.Open("C:\Data\Data1\Data2\A B C D E F.xls")
? wkbk.Name
A B C D E F.xls

--
Regards,
Tom Ogilvy

"Maury Markowitz" wrote in
message ...
This line works...

Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")

this one returns a 1004 error...

Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")

getting "smart" I tried...

Set working = Workbooks.Open("""L:\theFolder\The Email.xls""")

The file in question WILL have a space in the name when we receive it. Is
there some trick to opening the file when there's a space in the name?

Maury



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Opening a file with a space in the name?

Perhaps it is not a space, just looks like one. If in Excel you use File +
Save AS, type MY followed by Alt + digits 2 5 5 on the numeric keypad followd
by some file.xls, the resulting filename looks like MY file.xls but the
character between the Y and the f is NOT a space.



"Tom Ogilvy" wrote:

You must have misspelled the name (maybe it has two spaces).

This worked fine for me (demo'd from the immediate window)

set wkbk = Workbooks.Open("C:\Data\Data1\Data2\A B C D E F.xls")
? wkbk.Name
A B C D E F.xls

--
Regards,
Tom Ogilvy

"Maury Markowitz" wrote in
message ...
This line works...

Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")

this one returns a 1004 error...

Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")

getting "smart" I tried...

Set working = Workbooks.Open("""L:\theFolder\The Email.xls""")

The file in question WILL have a space in the name when we receive it. Is
there some trick to opening the file when there's a space in the name?

Maury




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Opening a file with a space in the name?

"AA2e72E" wrote:

Perhaps it is not a space, just looks like one. If in Excel you use File +
Save AS, type MY followed by Alt + digits 2 5 5 on the numeric keypad followd
by some file.xls, the resulting filename looks like MY file.xls but the
character between the Y and the f is NOT a space.


I think this is the problem. I wiped out the filename and retyped it with
the space and it worked ok!

Maury
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Opening a file with a space in the name?

Hi Maury,

One thing you can try:

1) Go to Tools | Options, General tab, and make sure "Ignore other
applications" is unchecked.

If that doesn't work, close Excel and try this:

2) Go to Start | Run in Windows, type "excel /regserver", and click OK.


--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Maury Markowitz wrote:
This line works...

Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")

this one returns a 1004 error...

Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")

getting "smart" I tried...

Set working = Workbooks.Open("""L:\theFolder\The Email.xls""")

The file in question WILL have a space in the name when we receive
it. Is there some trick to opening the file when there's a space in
the name?

Maury




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default Opening a file with a space in the name?

So you mean the file received may or may not have space?
If this is the case then try:-

On Error Resume Next
Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")
If Err < 0 Then
Err.Clear
Set working = Workbooks.Open("L:\theFolder\The Email.xls")
End If
On Error GoTo 0

Sharad

"Maury Markowitz" wrote in
message ...
This line works...

Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")

this one returns a 1004 error...

Set working = Workbooks.Open("L:\theFolder\TheEmail.xls")

getting "smart" I tried...

Set working = Workbooks.Open("""L:\theFolder\The Email.xls""")

The file in question WILL have a space in the name when we receive it. Is
there some trick to opening the file when there's a space in the name?

Maury



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
opening an excel file opens a duplicate file of the same file skm Excel Discussion (Misc queries) 1 December 7th 05 05:52 PM
Parsing a space delimited file into segments robinsgate Excel Discussion (Misc queries) 6 March 18th 05 09:51 PM
HOW DO I EDIT AN EXISTING FILE TO BE SPACE DELIMITED? cf Excel Discussion (Misc queries) 1 February 18th 05 05:29 PM
XL97: Out of stack space opening web page as workbook Dianne Butterworth Excel Programming 0 June 4th 04 04:53 PM
VBA - import txt file using space separator SuperPhil Excel Programming 0 August 2nd 03 10:39 AM


All times are GMT +1. The time now is 03:56 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"