LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Method proceeds but not taking action-Gurus help here

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
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
Excell copy action pauses for 15 second for the smallest action Meekal Excel Discussion (Misc queries) 1 January 28th 10 04:30 PM
Copying data to 2nd Workbook slows down as it proceeds GusEvans Excel Programming 0 November 20th 06 09:50 PM
Chart Gurus--Please Help Conan Kelly Charts and Charting in Excel 1 September 16th 05 09:10 AM
HELP! Do While...Loop slower as it proceeds??? Haettner Excel Programming 4 October 20th 03 02:39 PM


All times are GMT +1. The time now is 06:02 AM.

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"