View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Problem running macros in Excel filenames containing specialcharacters like []

I created a file with macros and saved it as book1.xls.

I closed excel and used windows explorer to rename the file to book[1].xls.

I reopened that book[1].xls file and excel's caption showed

microsoft excel - book[1].xls

But inside the VBE, excel was treating the filename as: book(1).xls.
(both in the project explorer and debug.print thisworkbook.name)

So I think the best solution is not to use those []'s in the file name
(difficult to do if MSIE is doing the naming!).

You may want to make sure your temp folder is empty as well as the temporary
internet files are empty. (Maybe MSIE won't bother adding [1] to the file name
if there's no existing file with the real name (just a guess).

Alternatively, I think I'd just save the file in MSIE using a name excel likes.

Good luck,

Remy wrote:

Thanks, that might be a good workaround.
But the core issue is that if you have an Excel sheet with [] in the
filename, toolbars that call macros do not work anymore.
You can try that out easy by creating your own toolbar, link it to a
macro, save the file, rename it to something like myfile[1].xls and
then open it and try again...


--

Dave Peterson