Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Disassociate Macros when saving under different name

I have a macro which removes some sheets from a workbook, removes shapes
which run macros and saves the file under a new file name.

The macro runs and appears to do what it should but when I try to open the
newly saved file I see the front sheet but get an error message saying
Excel.exe has generated errors and will be closed by Windows.

I wondered if the solution would be to remove all the macros in This
Workbook (that's the only location) before the file save as process in case
the Auto_Open is causing a glitch. If so, how do I do this?

I'm running Office 2000 on Windows 2000.

I've put the code below to help make it clearer.

I'd appreciate any help with this as I've been stuck for hours. Thanks a
lot in anticipation.

Keith
----------
ActiveWindow.DisplayWorkbookTabs = True
Application.DisplayAlerts = False
Sheets("Menu").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Workings").Select
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
Sheets("Month by Month Analysis").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Branch Analysis").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Signup Report").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Banked Report").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Incentives").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Data").Select
ActiveSheet.Shapes("AutoShape 12").Select
Selection.Cut
Sheets("Month by Month Analysis").Select
Range("A1").Select

ThisWorkbook.SaveAs "c:\#Reports\Reports\Reports " & Format(Date,
"dd-mm-yyyy")
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Disassociate Macros when saving under different name

If you think it maybe be you're auto_open macro causing trouble, put code in
it to exit the sub if certain sheets or shapes are missing.
For instance if sheet1. runs code but is removed with your save macro, on
auto_open check for sheet1 If it is not there, exit sub

"nospaminlich" wrote:

I have a macro which removes some sheets from a workbook, removes shapes
which run macros and saves the file under a new file name.

The macro runs and appears to do what it should but when I try to open the
newly saved file I see the front sheet but get an error message saying
Excel.exe has generated errors and will be closed by Windows.

I wondered if the solution would be to remove all the macros in This
Workbook (that's the only location) before the file save as process in case
the Auto_Open is causing a glitch. If so, how do I do this?

I'm running Office 2000 on Windows 2000.

I've put the code below to help make it clearer.

I'd appreciate any help with this as I've been stuck for hours. Thanks a
lot in anticipation.

Keith
----------
ActiveWindow.DisplayWorkbookTabs = True
Application.DisplayAlerts = False
Sheets("Menu").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Workings").Select
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
Sheets("Month by Month Analysis").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Branch Analysis").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Signup Report").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Banked Report").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Incentives").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Data").Select
ActiveSheet.Shapes("AutoShape 12").Select
Selection.Cut
Sheets("Month by Month Analysis").Select
Range("A1").Select

ThisWorkbook.SaveAs "c:\#Reports\Reports\Reports " & Format(Date,
"dd-mm-yyyy")
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Disassociate Macros when saving under different name

You can open excel in save mode. Go to the run command under the start menu
and type

excel.exe /s

and then try to open your files.

You can also hold down the shift key while you open the file to disable
macros (or change the security setting so you are prompted to disable
macros).


If you still have problems with the files, then removing the macro is
probably not going to rectify you problem.

--
Regards,
Tom Ogilvy

"nospaminlich" wrote in message
...
I have a macro which removes some sheets from a workbook, removes shapes
which run macros and saves the file under a new file name.

The macro runs and appears to do what it should but when I try to open the
newly saved file I see the front sheet but get an error message saying
Excel.exe has generated errors and will be closed by Windows.

I wondered if the solution would be to remove all the macros in This
Workbook (that's the only location) before the file save as process in

case
the Auto_Open is causing a glitch. If so, how do I do this?

I'm running Office 2000 on Windows 2000.

I've put the code below to help make it clearer.

I'd appreciate any help with this as I've been stuck for hours. Thanks a
lot in anticipation.

Keith
----------
ActiveWindow.DisplayWorkbookTabs = True
Application.DisplayAlerts = False
Sheets("Menu").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Workings").Select
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
Sheets("Month by Month Analysis").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Branch Analysis").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Signup Report").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Banked Report").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Incentives").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Data").Select
ActiveSheet.Shapes("AutoShape 12").Select
Selection.Cut
Sheets("Month by Month Analysis").Select
Range("A1").Select

ThisWorkbook.SaveAs "c:\#Reports\Reports\Reports " & Format(Date,
"dd-mm-yyyy")
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Disassociate Macros when saving under different name

hi,
have a look at this site. it helped me.
http://www.cpearson.com/excel/vbe.htm
be careful not to delete the macro that is deleted all the
macros.

-----Original Message-----
I have a macro which removes some sheets from a

workbook, removes shapes
which run macros and saves the file under a new file name.

The macro runs and appears to do what it should but when

I try to open the
newly saved file I see the front sheet but get an error

message saying
Excel.exe has generated errors and will be closed by

Windows.

I wondered if the solution would be to remove all the

macros in This
Workbook (that's the only location) before the file save

as process in case
the Auto_Open is causing a glitch. If so, how do I do

this?

I'm running Office 2000 on Windows 2000.

I've put the code below to help make it clearer.

I'd appreciate any help with this as I've been stuck for

hours. Thanks a
lot in anticipation.

Keith
----------
ActiveWindow.DisplayWorkbookTabs = True
Application.DisplayAlerts = False
Sheets("Menu").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Workings").Select
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
Sheets("Month by Month Analysis").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Branch Analysis").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Signup Report").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Banked Report").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Incentives").Select
ActiveSheet.Shapes("AutoShape 1").Select
Selection.Cut
Sheets("Data").Select
ActiveSheet.Shapes("AutoShape 12").Select
Selection.Cut
Sheets("Month by Month Analysis").Select
Range("A1").Select

ThisWorkbook.SaveAs "c:\#Reports\Reports\Reports " &

Format(Date,
"dd-mm-yyyy")
End Sub

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Disassociate Macros when saving under different name

Thanks a lot for the replies.

I've at least now proved that by disabling macros the file still won't open.

If I maually save the file without without removing shapes and sheets it's
fine but
that leaves users able to run macros in the copy version which I don't want.

Any ideas what it could be in the code I posted above that is causing the
saved file to corrupt?

Is there a more reliable way of writing the code?

Thanks again

Keith


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Disassociate Macros when saving under different name

Possibly put the code in an addin. This separates the code from the
workbook.

--
Regards,
Tom Ogilvy

"nospaminlich" wrote in message
...
Thanks a lot for the replies.

I've at least now proved that by disabling macros the file still won't

open.

If I maually save the file without without removing shapes and sheets it's
fine but
that leaves users able to run macros in the copy version which I don't

want.

Any ideas what it could be in the code I posted above that is causing the
saved file to corrupt?

Is there a more reliable way of writing the code?

Thanks again

Keith



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
Saving Macros MAtt Excel Discussion (Misc queries) 2 June 4th 08 06:07 PM
Disassociate existing macro from control key and execute by botton Trebor Retrac Excel Discussion (Misc queries) 2 September 3rd 05 02:40 AM
Saving Macros Gerald Excel Discussion (Misc queries) 1 August 19th 05 02:28 PM
weird saving of a document with macros resulting with macros being transfered to the copy alfonso gonzales Excel Programming 0 December 12th 04 09:19 PM
Saving Macros brodine Excel Worksheet Functions 1 November 9th 04 04:14 PM


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