ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get range value active workbook on open add-in (https://www.excelbanter.com/excel-programming/322883-re-get-range-value-active-workbook-open-add.html)

Ajtb

Get range value active workbook on open add-in
 
Hi
It sounds like you need to install a class module to trap and monitor
when a workbook is opened. You can then also check the value in cell A1
and run procedures accordingly.
Something like this:

Private Sub ClassApp_WorkbookActivate(ByVal Wb As Workbook)
Select Case Wb.Name

Case Name1
do things here

Case Name2
do things here

End Select


End Sub
or
Private Sub ClassApp_SheetActivate(ByVal Sh As Object)

if activesheet = workbooks("Whatever.xls").Sheets(1) then


end if


End Sub


HTH
Andrew Bourke



RB Smissaert wrote:
Have the following situation:
One installed add-in.
When Excel starts this add-in will open (but not install) another add-in.
Now when this second add-in opens I want it to get the value of cell A1
in sheet 1 of the active workbook.
This now turns out to be very difficult.
It somehow has to work with the open event of the second add-in.
The problem is that this second add-in gets opened before the sheet of
the active workbook is there.
I have tried with all kind of waiting loops, but no success sofar.
The idea is that when a particular workbook gets opened by
double-clicking it the second add-in will run
code depending on the value in cell A1 of the active workbook.
Thanks for any advice.

RBS


RB Smissaert

Get range value active workbook on open add-in
 
Thanks.
I had a go with that from an example of Chip Pearson, but couldn't get it to
work.
Will try again.

RBS

"Ajtb" wrote in message
...
Hi
It sounds like you need to install a class module to trap and monitor when
a workbook is opened. You can then also check the value in cell A1 and run
procedures accordingly.
Something like this:

Private Sub ClassApp_WorkbookActivate(ByVal Wb As Workbook)
Select Case Wb.Name

Case Name1
do things here

Case Name2
do things here

End Select


End Sub
or
Private Sub ClassApp_SheetActivate(ByVal Sh As Object)

if activesheet = workbooks("Whatever.xls").Sheets(1) then


end if


End Sub


HTH
Andrew Bourke



RB Smissaert wrote:
Have the following situation:
One installed add-in.
When Excel starts this add-in will open (but not install) another add-in.
Now when this second add-in opens I want it to get the value of cell A1
in sheet 1 of the active workbook.
This now turns out to be very difficult.
It somehow has to work with the open event of the second add-in.
The problem is that this second add-in gets opened before the sheet of
the active workbook is there.
I have tried with all kind of waiting loops, but no success sofar.
The idea is that when a particular workbook gets opened by
double-clicking it the second add-in will run
code depending on the value in cell A1 of the active workbook.
Thanks for any advice.

RBS




All times are GMT +1. The time now is 02:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com