Brackets in Excel filenames

J

JT Lovell

Here's the scenario:

I have Excel documents that have brackets in the file name, such as:
"[B4Z000000]JT's Warehouse_B9F2D7B38E2FE1D1_20031120174016.xls"

When I try to open these excel files I get strange results such as the worksheet names looking like this:
"JT's Warehouse_B9F2D7B38E2FE1D1_20031120172856.xls]JT_TEST"

However, if I rename the file to:
"JT's Warehouse_B9F2D7B38E2FE1D1_20031120174016.xls"

The worksheet names appear normally like this:
"JT_TEST"

I'm new to programming Excel so maybe this is an obvious question, but... Why does this happen? Does using brackets in the filename signify something else? The filename itself seems to be working just fine, but it causes me troubles because it is renaming the worksheets.

Further Background:

I'm using VB6 to call Excel, but I see this behavior even when just opening an excel file normally.
I have to use brackets in the file names, however I've considered removing the bracketed header, working with the file, and then putting the header back if there's no other way to fix this.

Any/all help is appreciated! Thanks,
 
T

Tom Ogilvy

excel refers to a workbook like this:

'[Book1.xls]Sheet1'!A1
or a closed workbook like this

'C:\My Documents\[Book1.xls]Sheet1'!A1

so having brackets in the file name definitely screws things up.

--
Regards,
Tom Ogilvy

Here's the scenario:

I have Excel documents that have brackets in the file name, such as:
"[B4Z000000]JT's Warehouse_B9F2D7B38E2FE1D1_20031120174016.xls"

When I try to open these excel files I get strange results such as the
worksheet names looking like this:
"JT's Warehouse_B9F2D7B38E2FE1D1_20031120172856.xls]JT_TEST"

However, if I rename the file to:
"JT's Warehouse_B9F2D7B38E2FE1D1_20031120174016.xls"

The worksheet names appear normally like this:
"JT_TEST"

I'm new to programming Excel so maybe this is an obvious question, but...
Why does this happen? Does using brackets in the filename signify something
else? The filename itself seems to be working just fine, but it causes me
troubles because it is renaming the worksheets.

Further Background:

I'm using VB6 to call Excel, but I see this behavior even when just opening
an excel file normally.
I have to use brackets in the file names, however I've considered removing
the bracketed header, working with the file, and then putting the header
back if there's no other way to fix this.

Any/all help is appreciated! Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top