Re: Spaces in folder name and file name

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



The code isn't the problem.

You've got a mismatch between your spelling of the drive/path/filename in your
code and the actual name of the file.

Merlynsdad wrote:

I'm defining a constant that will access a file. I've been testing it with
the following constant:

Const cstrDatabaseWB As String = "C:\Documents and Settings\5YPJB\My
Documents\Excel documents\Sherry project\real1.xls"

That works fine. Now I'm working with the real file, named by someone else,
and I've got the constant defined as

Const cstrDatabaseWB As String = "G:\WI\ACS\ACS QA\FY10 CQRS and Local
Reviews (version 1).xls"

There is a space in the folder name "ACS AQ" and multiple spaces in the
filename. I'm getting a Run time Error 1004 Application/Object Defined Error
when the code tries to execute the following line:

Application.Workbooks.Open (cstrDatabaseWB)

I tried using single quotes inside the double quotes around the file name
but that didn't help. How do I need to modify this code to open this file?

Any help will be greatly appreciated.

--

Dave Peterson
.



Relevant Pages

  • Spaces in folder name and file name
    ... I'm defining a constant that will access a file. ... There is a space in the folder name "ACS AQ" and multiple spaces in the ... I'm getting a Run time Error 1004 Application/Object Defined Error ... I tried using single quotes inside the double quotes around the file name ...
    (microsoft.public.excel.programming)
  • Re: Spaces in folder name and file name
    ... You'll be able to copy|paste from that immediate window into your code. ... There is a space in the folder name "ACS AQ" and multiple spaces in the ... I'm getting a Run time Error 1004 Application/Object Defined Error ... I tried using single quotes inside the double quotes around the file name ...
    (microsoft.public.excel.programming)
  • Re: Mandis Quotes (aka retiring """ and )
    ... > surround the string by a pair of doubled single quotes. ... > an arbitrary string in-between the single quotes which does NOT ... > of ASCII or Unicode characters, but instead as a sequence of lines ...
    (comp.lang.python)
  • Re: quotes from form input + MySQL insert query
    ... string mysql_escape_string ... > same way, but a textarea string full of single quotes is handled fine, while ... I've checked the POSTed data by echoing ... > backslashes, in case the single ones generated by magic_quotes weren't ...
    (alt.php)
  • Re: Mandis Quotes (aka retiring """ and )
    ... >surround the string by a pair of doubled single quotes. ... > of ASCII or Unicode characters, but instead as a sequence of lines ... Quoting "arbitrary" text also involves the issue of encoding, ...
    (comp.lang.python)