Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add-in to run macro when ANY workbook is opened?


i would like to create an add-in that runs when any workbook is opened
I didnt think i could use the workbook_open code b/c that would have t
reside in the individual workbooks, am i wrong in that assumption?

thanks

--
jrupper
-----------------------------------------------------------------------
jruppert's Profile: http://www.excelforum.com/member.php...nfo&userid=317
View this thread: http://www.excelforum.com/showthread.php?threadid=27560

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Add-in to run macro when ANY workbook is opened?

You need to create an application-level event.
see Chip Pearson's page at
http://www.cpearson.com/excel/AppEvent.htm


Charles
______________________
Decision Models
FastExcel 2.1 now available
www.DecisionModels.com

"jruppert" wrote in message
...

i would like to create an add-in that runs when any workbook is opened.
I didnt think i could use the workbook_open code b/c that would have to
reside in the individual workbooks, am i wrong in that assumption?

thanks.


--
jruppert
------------------------------------------------------------------------
jruppert's Profile:
http://www.excelforum.com/member.php...fo&userid=3170
View this thread: http://www.excelforum.com/showthread...hreadid=275605



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Add-in to run macro when ANY workbook is opened?


You'll have to set a reference to the application object
AND monitor the application events. You could create a classmodule but
following is simpler.


in the addin's Thisworkbook object module:

Option Explicit

Dim WithEvents xlApp As Application

Private Sub Workbook_Open()
Set xlApp = Application
End Sub

Private Sub xlApp_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)
If Target.Address < "$A$1" Then
Sh.Cells(1).Select
End If
End Sub


instantiate the xlapp variable by running the workbook_open procedure
(once) then try to navigate your workbooks :)


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


jruppert wrote :


i would like to create an add-in that runs when any workbook is opened.
I didnt think i could use the workbook_open code b/c that would have to
reside in the individual workbooks, am i wrong in that assumption?

thanks.



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
How to run a macro as soon a a workbook (.xls) is opened? Sangamesh Acharya Excel Worksheet Functions 1 December 15th 05 11:15 PM
Macro to Record date workbook is first opened darkeh Excel Programming 2 October 15th 04 06:34 PM
Looking for a way to run a macro when the workbook is opened Bob Reynolds[_3_] Excel Programming 3 September 25th 04 02:58 PM
Run a macro when a workbook is opened Mervyn Thomas[_3_] Excel Programming 2 July 25th 03 11:40 AM
Run a macro when a workbook is opened Mervyn Thomas[_3_] Excel Programming 0 July 25th 03 11:18 AM


All times are GMT +1. The time now is 02:06 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"