[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

GS

6/18/2007 7:11:00 AM

according to help
Dim Obj As New Class1
' Associate an event handler with an event.
AddHandler Obj.Ev_Event, AddressOf EventHandler
is the way to go, so I tried
oBook = oExcel.Workbooks.Add
' Associate an event handler with an event.
AddHandler oBook.WorkbookBeforeClose, AddressOf
xlApp_WorkbookBeforeClose

and I got
Error 4 'WorkbookBeforeClose' is not an event of
'Microsoft.Office.Interop.Excel.Workbook'.

what do I have to do with the handler below to make it work?


Private Sub xlApp_WorkbookBeforeClose(ByVal Wb As Excel.Workbook, _
ByRef Cancel As Boolean)
'Debug.WriteLine("WithEvents: Closing the workbook.")
Wb.Saved = True 'Set the dirty flag to true so there is no prompt to
save
End Sub




7 Answers

SvenC

6/18/2007 10:57:00 AM

0

Hi,

> according to help
> Dim Obj As New Class1
> ' Associate an event handler with an event.
> AddHandler Obj.Ev_Event, AddressOf EventHandler
> is the way to go, so I tried
> oBook = oExcel.Workbooks.Add
> ' Associate an event handler with an event.
> AddHandler oBook.WorkbookBeforeClose, AddressOf
> xlApp_WorkbookBeforeClose
>
> and I got
> Error 4 'WorkbookBeforeClose' is not an event of
> 'Microsoft.Office.Interop.Excel.Workbook'.

The event is fired from the Application object. So you would need something
like

AddHandler oExcel.WorkbookBeforeClose, AddressOf xlApp_WorkbookBeforeClose

Assuming that oExcel is of type Excel.Application.
--
SvenC

GS

6/18/2007 3:23:00 PM

0

wonderful.
Thank you vary much for your helpful and detailed answer.

"SvenC" <SvenC@community.nospam> wrote in message
news:D9EFA9ED-7141-4E2C-A665-055FEC4643AD@microsoft.com...
> Hi,
>
> > according to help
> > Dim Obj As New Class1
> > ' Associate an event handler with an event.
> > AddHandler Obj.Ev_Event, AddressOf EventHandler
> > is the way to go, so I tried
> > oBook = oExcel.Workbooks.Add
> > ' Associate an event handler with an event.
> > AddHandler oBook.WorkbookBeforeClose, AddressOf
> > xlApp_WorkbookBeforeClose
> >
> > and I got
> > Error 4 'WorkbookBeforeClose' is not an event of
> > 'Microsoft.Office.Interop.Excel.Workbook'.
>
> The event is fired from the Application object. So you would need
something
> like
>
> AddHandler oExcel.WorkbookBeforeClose, AddressOf xlApp_WorkbookBeforeClose
>
> Assuming that oExcel is of type Excel.Application.
> --
> SvenC
>


Gerry

6/7/2010 9:18:00 PM

0

On 2010-06-07 14:01:47 -0700, southtexasguitarist said:

> On Jun 7, 11:29?am, Des Higgins <dazzhigg...@hotmail.com> wrote:
>> On Jun 7, 5:27?pm, Joey Goldstein <nos...@nowhere.net> wrote:
>>
>>> <http://www.youtube.com/watch?v=MiRxL...
>>
>>> What are they feeding these kids?
>>
>> Bacon and Cabbage in this case; he is based in Limerick
>
> I smell a late night infomercial in the making.
>
> And now, in honor of Limerick:
>
> There once was a young jazz sensation,
> Who came from an unlikely nation.
> Fed cabbage and stout,
> he played his heart out.
> What's next? A cool jazz Croatian?

Good news, Clay! You have bright second-career options!

Or maybe that's third...
--
-- Gerry

clay@claymoore.com

6/7/2010 9:26:00 PM

0

On Jun 7, 4:18 pm, Gerry <addr...@domain.com> wrote:
> On 2010-06-07 14:01:47 -0700, southtexasguitarist said:
>
>
>
>
>
> > On Jun 7, 11:29 am, Des Higgins <dazzhigg...@hotmail.com> wrote:
> >> On Jun 7, 5:27 pm, Joey Goldstein <nos...@nowhere.net> wrote:
>
> >>> <http://www.youtube.com/watch?v=MiRxL...
>
> >>> What are they feeding these kids?
>
> >> Bacon and Cabbage in this case; he is based in Limerick
>
> > I smell a late night infomercial in the making.
>
> > And now, in honor of Limerick:
>
> > There once was a young jazz sensation,
> > Who came from an unlikely nation.
> > Fed cabbage and stout,
> > he played his heart out.
> > What's next? A cool jazz Croatian?
>
> Good news, Clay!  You have bright second-career options!
>
> Or maybe that's third...
> --
>  -- Gerry

I can see it now. "Who's that sharp dressed guy in the Ferrari with
the super model?"
"Duh, that's Clay Moore, international Limerick writing star. You are
so out of touch!"

Des Higgins

6/7/2010 9:36:00 PM

0

On Jun 7, 10:01 pm, southtexasguitarist <c...@claymoore.com> wrote:
> On Jun 7, 11:29 am, Des Higgins <dazzhigg...@hotmail.com> wrote:
>
> > On Jun 7, 5:27 pm, Joey Goldstein <nos...@nowhere.net> wrote:
>
> > > <http://www.youtube.com/watch?v=MiRxL...
>
> > > What are they feeding these kids?
>
> > Bacon and Cabbage in this case; he is based in Limerick
>
> I smell a late night infomercial in the making.
>
> And now, in honor of Limerick:
>
> There once was a young jazz sensation,
> Who came from an unlikely nation.
> Fed cabbage and stout,
> he played his heart out.
> What's next? A cool jazz Croatian?

Ho Ho :-)

Gerry

6/7/2010 11:17:00 PM

0

On 2010-06-07 14:26:02 -0700, southtexasguitarist said:

>>> There once was a young jazz sensation,
>>> Who came from an unlikely nation.
>>> Fed cabbage and stout,
>>> he played his heart out.
>>> What's next? A cool jazz Croatian?
>>
>> Good news, Clay! ?You have bright second-career options!
>>
>> Or maybe that's third...
>
> I can see it now. "Who's that sharp dressed guy in the Ferrari with
> the super model?"
> "Duh, that's Clay Moore, international Limerick writing star. You are
> so out of touch!"

MAKE it happen, bro!
--
-- Gerry

Frisbieinstein

6/10/2010 4:40:00 AM

0

On Jun 8, 5:01 am, southtexasguitarist <c...@claymoore.com> wrote:
> On Jun 7, 11:29 am, Des Higgins <dazzhigg...@hotmail.com> wrote:
>
> > On Jun 7, 5:27 pm, Joey Goldstein <nos...@nowhere.net> wrote:
>
> > > <http://www.youtube.com/watch?v=MiRxL...
>
> > > What are they feeding these kids?
>
> > Bacon and Cabbage in this case; he is based in Limerick
>
> I smell a late night infomercial in the making.
>
> And now, in honor of Limerick:
>
> There once was a young jazz sensation,
> Who came from an unlikely nation.
> Fed cabbage and stout,
> he played his heart out.
> What's next? A cool jazz Croatian?

Fresh out of Croatians, but I got Macedonians...

http://www.youtube.com/watch?v=Z...

Giant Steps. Piano and drums. Sorry, no guitar, but it is quite
smooth.