Get range value active workbook on open add-in

  • Thread starter Thread starter RB Smissaert
  • Start date Start date
R

RB Smissaert

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
 
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
 
Thanks.
I had a go with that from an example of Chip Pearson, but couldn't get it to
work.
Will try again.

RBS
 

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

Back
Top