Automation Error Exception Occurred

  • Thread starter Thread starter Barb Reinhardt
  • Start date Start date
B

Barb Reinhardt

I consistently get this error when I get to this line in code. The workbook
is saved as an .xls and I'm opening another workbook, converting it to a new
format and saving the new workbook.

oWB.SaveAs Filename:="test.xls", FileFormat:=56

The current fileformat of oWB is 56 and the file name is MyFileName.xls

After Excel crashes I get the following error (sometimes)

Microsoft Office Excel has encountered a problem and needs to close. ...

Dueing the recovery, I get this message

Automation error. Exception Occurred and I enter OK. I've actually put in
On Error Resume next to see if I can capture the Err code, but it crashes
before I get the code.

When I try to open the Repaired version of the workbook I was trying to
save, I get

MyOriginalFilename.xls (version 1).xls: file format is not valid.

OK, I'm pretty sure I'm using the correct file format, but it's not working.
FWIW, I'm using a new laptop and haven't tried to run this code on this
machine. I was on 2003 before the refresh and now am on 2007. I haven't
tried to run this code in 2007 since I converted to 2007 a couple of weeks
back, but I'm not sure if it's the patches or the code.

I've had several security updates installed today. They include KB960803,
KB959426, KB963027, KB923561, KB956572, KB952004, KB961373. I have no idea
if they are related or not.

When I run it in Excel 2003, (with this convention)

oWB.saveas "myfile.xls"

it works fine. What concerns me it that there is another application out
there that uses the same SaveAs coding in Excel 2007 that once worked
(although when I test that today, it's working fine)

When I look at the folder I'm saving to, I see that the Attribute for
ReadOnly is greyed out (no X, but not clear). Is there some way I
candetermine if I can write to this folder? I did try to use similar saveas
code to another folder with the same attributewithout an issue.

I know there is a lot here, but this is driving me nuts. Ron has helped
some earlier, but I have more info now and am posting a new thread.

Thanks for any assistance,
Barb Reinhardt
 
Hi Barb,

Try closing xls type the file immediately after saving and re-opening. I
have had problems and I think it might be due to the number of Rows and
Columns.

If you open a new workbook in xl2007 and then save it as xls type then you
can still access all the extra rows and columns until it is closed and
re-opened. One would expect them to disappear immediately.

I am not certain this is the answer but will be interested in your results.
 
Back
Top