excel vba withevents vbe
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Excel vba, withevents, vbe events

Excel vba, withevents, vbe events

resolvedResolved · Low Priority · Version 2010

replyReply Fri 2 Dec 2011, 15:46Delegate C said...

C has attended:
No courses

Excel vba, withevents, vbe events

Hi,

I'm working with application events and want to control the following workflow:

1. When application starts, it creates xlApp WithEvents (in a class module)

Private WithEvents xlApp As Excel.Application

2. I want to stop the standard 'SaveAs' dialog showing but instead have created a Userform (as my new SaveAs). This is to be triggered with either the xlApp_WorkbookBeforeClose or xlApp_WorkbookBeforeSave procedures.

3. When calling it via the BeforeClose event and which triggers the Save event, I have chosen to set Cancel=True which stops the standard dialog and then I call my Userform - All OK so far.

4. But when I decide to click Cancel via the Userform (where I would like to close the workbook as unsaved), I'm still being prompted for the standard "Save, Don't Save and Cancel" prompt as it attempts to close the workbook again.

How do I stop this from showing again as the workbooks tries to close?

I added boolean flags to test and trap for this in order to force a close method using wb.Close False but this crashes the whole application.

The Cancel argument via the xlApp_WorkbookBeforeClose procedure is of no use as this just stops the close event being triggered altogether.

Some help would be ap[preciated please
csimms@fsmail.net

For upcoming training course dates see: Pricing & availability

replyReply Tue 6 Dec 2011, 10:30Trainer Jacob said...

RE: excel vba, withevents, vbe events

Hi there

Thanks for your post which has been reviewed by one my colleagues. This is beyond the scope of this forum as we will really need to see your working files and spend some time testing potential solutions.

We term this as consultancy as specific resource and time needs to be committed with associated costs.

If you would like to discuss this further then please do reply to my email.

Kind regards

Jacob

Mon 12 Dec 2011: Automatically marked as resolved.

 

Please browse our web site to find out more about
excel computer training london and other Microsoft training courses.

Excel tip:

Switch between workbooks ni EXCEL.

use Alt-TAB to switch between workbooks.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard