PC Review


Reply
Thread Tools Rate Thread

App_WorkBookBeforeClose()

 
 
kalyani.deepa@googlemail.com
Guest
Posts: n/a
 
      30th Apr 2007
Hi ,

I have a piece of VBA code , it goes like this , the class module has
Public WithEvents app As Application

Private Sub App_WorkbookBeforeClose(ByVal Wb As Workbook, _
Cancel As Boolean)
a = MsgBox("Do you really want to close the workbook?", _
vbYesNo)
If a = vbNo Then Cancel = True
End Sub
for WorkBookBeforeClose under app tab

and another module has

Public oappobject As New Class1
Sub auto_open()
Set oappobject.app = Application

End Sub

for auto_open under General tab in VBA

I saved this as Test.xla , and put under XLSTART folder .
When excel is run , my message appears twice for Excel 2003 and once
for Excel 2000. Can somebody explain the behaviour and suggest a
workaround for this .

Thanks in anticipation,
Deepa

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      30th Apr 2007
Deepa,

I have just re-created your situation, and I only get the one message in
Excel 2003.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi ,
>
> I have a piece of VBA code , it goes like this , the class module has
> Public WithEvents app As Application
>
> Private Sub App_WorkbookBeforeClose(ByVal Wb As Workbook, _
> Cancel As Boolean)
> a = MsgBox("Do you really want to close the workbook?", _
> vbYesNo)
> If a = vbNo Then Cancel = True
> End Sub
> for WorkBookBeforeClose under app tab
>
> and another module has
>
> Public oappobject As New Class1
> Sub auto_open()
> Set oappobject.app = Application
>
> End Sub
>
> for auto_open under General tab in VBA
>
> I saved this as Test.xla , and put under XLSTART folder .
> When excel is run , my message appears twice for Excel 2003 and once
> for Excel 2000. Can somebody explain the behaviour and suggest a
> workaround for this .
>
> Thanks in anticipation,
> Deepa
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
App_WorkbookBeforeClose Kent Prokopy Microsoft Excel Programming 1 25th Aug 2008 04:30 PM
HELP with App_WorkbookBeforeClose!!! carlos_almeida@netvisao.pt Microsoft Excel Programming 0 4th Jun 2007 11:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:05 PM.