Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following codes include a module and a class. When I run the module, the
Wb_beforesave event is activated and executed. However, the line with "Sheets.add" is proceeded but a new sheet is not added as expected. Any guru knows why this happens and how to solve the problem? For certain reason, I can not move the "sheets.add" line to the test module before "activeworkbook.save". I just want to know why my codes do not work in the way it should work. I have posted in severl excel forums but seems no one could answer. Thanks! David Module Dim X As New Class1 Sub test() Set X.App = Application Set X.Wb = ActiveWorkbook ActiveWorkbook.Save End Sub Class Name: Class1 Public WithEvents App As Application Public WithEvents Wb As Workbook Private Sub Wb_BeforeSave(ByVal SaveAsUI As Boolean, _ Cancel As Boolean) ActiveWorkbook.Sheets.Add after:=Worksheets(ActiveWorkbook.Worksheets.Count) End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excell copy action pauses for 15 second for the smallest action | Excel Discussion (Misc queries) | |||
Copying data to 2nd Workbook slows down as it proceeds | Excel Programming | |||
Chart Gurus--Please Help | Charts and Charting in Excel | |||
HELP! Do While...Loop slower as it proceeds??? | Excel Programming |