Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 390
Default Macro error - open file with 'Invalid sheet name' - repair/recover

Another department has a program that exports a report to xls which they
save. I'm helping them by building a macro that has them open this file to
use for a comparison against another file. Problem is, their system exports
the file with a bad sheet name and the code 'Workbooks.Open filename' won't
open it at all and just goes to debug. Anyone know a way around this so it
opens it?

I know they can open it manually, hit ok on the alerts, rename the sheet and
resave. But they aren't really that computer savvy and was hoping not to
risk it. Done it in the past that way and still get calls sometimes from new
users, was hoping to find solution to avoid it this time.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Macro error - open file with 'Invalid sheet name' - repair/recover

Bill,

I don't understand this. Particularly, how does this other department mange
to save an Excel file with an invalid (Bad) sheet name? excel will reject
illegal sheet names when you try and rename a sheet with an illegal name so
it shouldn't even be possible to create one.

I think we need to see this code that's giving errors, if the workbook can
be opened manually then I'm struggling to understand why it can't be opened
with code.

Mike

"Bill" wrote:

Another department has a program that exports a report to xls which they
save. I'm helping them by building a macro that has them open this file to
use for a comparison against another file. Problem is, their system exports
the file with a bad sheet name and the code 'Workbooks.Open filename' won't
open it at all and just goes to debug. Anyone know a way around this so it
opens it?

I know they can open it manually, hit ok on the alerts, rename the sheet and
resave. But they aren't really that computer savvy and was hoping not to
risk it. Done it in the past that way and still get calls sometimes from new
users, was hoping to find solution to avoid it this time.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 390
Default Macro error - open file with 'Invalid sheet name' - repair/rec

The program they use doesn't open the file at all so they don't get the
error, it just exports an xls file. We have many programs that tend to do
this and I don't know why their programmers didn't set it up for a valid
sheet name. I tried to open it while recording macro, no extra coding came
up for the errors.

You get the run-time error '1004' - coding is below.

LPFile = Application.GetOpenFilename
Workbooks.Open LPFile

"Mike H" wrote:

Bill,

I don't understand this. Particularly, how does this other department mange
to save an Excel file with an invalid (Bad) sheet name? excel will reject
illegal sheet names when you try and rename a sheet with an illegal name so
it shouldn't even be possible to create one.

I think we need to see this code that's giving errors, if the workbook can
be opened manually then I'm struggling to understand why it can't be opened
with code.

Mike

"Bill" wrote:

Another department has a program that exports a report to xls which they
save. I'm helping them by building a macro that has them open this file to
use for a comparison against another file. Problem is, their system exports
the file with a bad sheet name and the code 'Workbooks.Open filename' won't
open it at all and just goes to debug. Anyone know a way around this so it
opens it?

I know they can open it manually, hit ok on the alerts, rename the sheet and
resave. But they aren't really that computer savvy and was hoping not to
risk it. Done it in the past that way and still get calls sometimes from new
users, was hoping to find solution to avoid it this time.

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
Open & repair didn't fix my excel file?! Nassar Excel Discussion (Misc queries) 1 December 3rd 09 08:58 AM
repair hyperlinks / testing for invalid address brzak Excel Programming 3 June 24th 08 09:37 AM
Excel does not open a file until it is minimized - how to repair? Duri Excel Discussion (Misc queries) 1 January 1st 08 11:16 PM
I need to repair an invalid hyperlink S. Banks - Admin. Asst. Excel Worksheet Functions 1 October 23rd 06 03:08 PM
error: "invalid character in text conent" How do I open this file RTH Excel Discussion (Misc queries) 5 April 23rd 06 03:04 PM


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