Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excel 97.
I have a small module in Workbook_Open() in the ThisWorkbook area. Otherwise there are maybe 100 lines of code spread between 1 worksheet module and a regular module. When I save the Excel workbook by File|Close, and then answer YES, the code that I have in Workbook_BeforeSave is executed, the file is saved and then it re-opens and executes Workbook_Open. I have a simple msgbox prompt in the Workbook_Open sub and it fires when I open the workbook and then again when I close it with File|Close. If I do a File|Save and then close Excel, everything happens as it should. Has anybody run into this before? Can I provide any more information to help you tell me what I might be doing wrong? Thanks mike |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Do you have a
ThisWorkbook.Close SaveChanges:=True in your BeforeSave code? Post your BeforeSave code. -- Regards, Tom Ogilvy "Mike Preston" wrote in message ... Excel 97. I have a small module in Workbook_Open() in the ThisWorkbook area. Otherwise there are maybe 100 lines of code spread between 1 worksheet module and a regular module. When I save the Excel workbook by File|Close, and then answer YES, the code that I have in Workbook_BeforeSave is executed, the file is saved and then it re-opens and executes Workbook_Open. I have a simple msgbox prompt in the Workbook_Open sub and it fires when I open the workbook and then again when I close it with File|Close. If I do a File|Save and then close Excel, everything happens as it should. Has anybody run into this before? Can I provide any more information to help you tell me what I might be doing wrong? Thanks mike |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thu, 28 Aug 2003 09:11:51 -0400, "Tom Ogilvy"
wrote: Do you have a ThisWorkbook.Close SaveChanges:=True in your BeforeSave code? No. Post your BeforeSave code. From the ThisWorkbook module: FromWhatSheet = ActiveSheet.Name FromWhatCell = ActiveCell.Address HideSheets ' Sub to hide all but the warning sheet From a standard module: Sub HideSheets() Sheets("Sheet1").Visible = True Sheets("Sheet2").Visible = xlSheetVeryHidden Sheets("Sheet3").Visible = xlSheetVeryHidden Sheets("Sheet4").Visible = xlSheetVeryHidden Sheets("Sheet5").Visible = xlSheetVeryHidden End Sub Thanks for the quick response, Tom. mike "Mike Preston" wrote in message ... Excel 97. I have a small module in Workbook_Open() in the ThisWorkbook area. Otherwise there are maybe 100 lines of code spread between 1 worksheet module and a regular module. When I save the Excel workbook by File|Close, and then answer YES, the code that I have in Workbook_BeforeSave is executed, the file is saved and then it re-opens and executes Workbook_Open. I have a simple msgbox prompt in the Workbook_Open sub and it fires when I open the workbook and then again when I close it with File|Close. If I do a File|Save and then close Excel, everything happens as it should. Has anybody run into this before? Can I provide any more information to help you tell me what I might be doing wrong? Thanks mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to save and close, then copy file | Excel Discussion (Misc queries) | |||
How to code the Macro to save and close a file? | Excel Discussion (Misc queries) | |||
File close excel does not ask me to save changes | Excel Discussion (Misc queries) | |||
I can't save a file unless I close all excel instances or it's th. | Excel Discussion (Misc queries) | |||
Automate open file, update links, run macro, close and save file | Excel Programming |