Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Add In Questions

Here are a couple of questions about using Add-Ins:

How can I attach an Add-In to a Workbook using VBA?

Once the Add-In is attached, how do I associate the subroutines and
functions in the add-in with events taking place in the workbook.worksheet
where it is attached? For example an on_activate event in Sheet1 of the
workbook that has an add-in attached needs to run code that exists in the
add-in.

Thanks,

Keith


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Add In Questions

An add-in is a workbook, albeit a special type of workbook. You don't attach
it to a workbook, it is available to the Excel application when installed,
and thus to all workbooks.

You can create worksheet events for all workbooks by creating application
events in the add-in. Here is some example code. First add a class module,
name it clsEventSink, and add this code

Option Explicit

Private WithEvents App As Application

Private Sub App_SheetActivate(ByVal Sh As Object)
'your code here
End Sub

Private Sub Class_Initialize()
Set App = Application
End Sub

Then in Thisworkbook, add this code
Option Explicit

Private cAppEvents As clsEventSink

Private Sub Workbook_Open()
Set cAppEvents = New clsEventSink
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code





--

HTH

RP
(remove nothere from the email address if mailing direct)


"keithb" wrote in message
...
Here are a couple of questions about using Add-Ins:

How can I attach an Add-In to a Workbook using VBA?

Once the Add-In is attached, how do I associate the subroutines and
functions in the add-in with events taking place in the workbook.worksheet
where it is attached? For example an on_activate event in Sheet1 of the
workbook that has an add-in attached needs to run code that exists in the
add-in.

Thanks,

Keith




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
Answers to questions posing more questions in a workbook sbelle1 Excel Worksheet Functions 2 August 8th 09 01:02 AM
View Questions and Answer to questions I created Roibn Taylor Excel Discussion (Misc queries) 4 July 24th 08 12:05 AM
007 questions Gklass Charts and Charting in Excel 5 February 5th 07 04:40 PM
2 Questions John Calder New Users to Excel 18 August 24th 06 04:17 AM
A few questions please help! mjay123 New Users to Excel 4 February 8th 06 08:04 PM


All times are GMT +1. The time now is 12:45 PM.

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"