VBA corrupts file after close

Felix Atagong

Active Member
Joined
Jun 27, 2003
Messages
359
I have got an XLS page (Q.xls) that opens in Excel 2007 and contains some VBA.

The VBA opens a text file, parses and saves the data in a temporary Excel file (Qtemp.xls) and sends that page as an attachment.
Qtemp.xls is then closed.
So is Q.xls without saving (as nothing has changed, all it does is start the macro to parse the text file).

However when I re-open Q.xls and press the macro button I get
CANNOT RUN THE MACRO #REF!
After that I get the message that Excel has encountered a problem and wants to restart and recover the file.

How can this file get corrupt as I don't even save it?
There is no VBA error as the code has been running for years on several computers, except this one.

Re-installing Excel?
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Naah, been there, done that, the thing is, if I take the Excel page (with macro) from my backup disk and save it to the computer, the macro will run.
But the sceond time it will not run any more. The file gets corrupted by opening and running the macro.
 
Upvote 0
I think 2007 likes to save XLS's with macros as XLSM, so maybe, if you want to keep your pre 2007 version, use the save as option and select 2003 as the type
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,525
Members
448,969
Latest member
mirek8991

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top