Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook Deactivate Event

Hi, I am trying to get code to run when I deactivate a Workbook

The following examples were taken from "Help" and created in a new
workbokk exactly as stated yet does nothing when I select a new
workbook or another application

Can you help? Thanks

TerryF

-------------------------------------------------

Using Events with the Application Object


Before you can use events with the Application object, you must create
a new class module and declare an object of type Application with
events. For example, assume that a new class module is created and
called "EventClassModule". The new class module contains the following
code.

Public WithEvents App As Application

After the new object has been declared with events, it appears in the
Object drop-down list box in the class module, and you can write event
procedures for the new object. (When you select the new object in the
Object box, the valid events for that object are listed in the
Procedure drop-down list box.)

Before the procedures will run, however, you must connect the declared
object in the class module with the Application object. You can do this
with the following code from any module.



Sub InitializeApp()

Dim X As New EventClassModule
Set X.App = Application

End Sub

After you run the InitializeApp procedure, the App object in the class
module points to the Microsoft Excel Application object, and the event
procedures in the class module


This example is supposed to arrange all open windows when a workbook is
deactivated. DOESN"T WORK!!


Private Sub App_WorkbookDeactivate(ByVal Wb As Workbook)

Application.Windows.Arrange xlArrangeStyleTiled

End Sub


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook Deactivate Event

Hi

Please decrale a variable X as a Public as follows, and run
"InitializeApp"


Code:
--------------------

Public X As New EventClassModule

Sub InitializeApp()

Set X.App = Application

End Sub

--------------------



---
Message posted from http://www.ExcelForum.com/

Reply
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
Changing sheets after the DeActivate Event. Richard Excel Discussion (Misc queries) 2 July 10th 08 03:49 PM
"Shared Workbook" seems to deactivate features like macros Steve Excel Discussion (Misc queries) 3 May 1st 07 05:11 PM
UserForms to deactivate workbook Vasant Nanavati Excel Programming 0 December 20th 03 05:09 AM
Canīt Convert Formulas to Values with Deactivate event Rolo[_3_] Excel Programming 2 November 8th 03 09:13 PM
need help with syntax of a Workbook Event Paul Simon[_2_] Excel Programming 3 July 30th 03 03:43 AM


All times are GMT +1. The time now is 07:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Đ2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"