class application events

  • Thread starter Lucas Hernandez
  • Start date
L

Lucas Hernandez

I have been trying to run the following code

created a class with
Public WithEvents appEvent As Application

Private Sub appevent_WindowResize(ByVal Wb As Excel.Workbook, ByVal Wn
As Excel.Window)
MsgBox "you have resized excel"
End Sub


then a module with

Dim myObject As New ClsAppEvents

Sub testObject()
Set myObject.appEvent = Application
End Sub


run testObject....

this is supposed to show "you have resized excel"

please let me know if I need to activate something to make it work

thanks

LH
 
A

Andy Pope

Hi,

The code is correct. But the Resize event will only fire when a workbook
is resized not the application.

In order to trigger the resize event run the testobject routine and then
with the workbook not in either the Minimized or Maximized state you can
resize the workbook and the event will fire. It will also fire when
changing window state between Minimized/Maximized/Restore.

Cheers
Andy
 
L

Lucas Hernandez

Andy said:
Hi,

The code is correct. But the Resize event will only fire when a workbook
is resized not the application.

In order to trigger the resize event run the testobject routine and then
with the workbook not in either the Minimized or Maximized state you can
resize the workbook and the event will fire. It will also fire when
changing window state between Minimized/Maximized/Restore.

Cheers
Andy
thank you.... I think I'll have to find an API method to solve my
problem...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top