Add-In to check workbook on open

Vlip

New Member
Joined
Mar 10, 2002
Messages
49
I have an application I wish to convert to an add-in. The macros in the application apply to only a specific type of workbook that I have identified by the title property. On open, there are a few operations I need to perform including adding the toolbar. I've tried the Auto_Open and Workbook_Open event procedures but they do not work. I get an "Object variable or With block variable not set" error. I believe this is because these event procedures are triggered when the add-in is opened and the actual workbook I want to refer to has not yet opened.

The code I am using is:
Private Sub Workbook_Open
If UCase(ActiveWorkbook.BuiltInDocumentProperties("Title")) = "TIME TRACKING TOOL" Then
....
End If

Anyone have any ideas?

Thanks,
Vlip
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
The problem is to be able to trap the workbook_Open event at Application level. You could then check the ActiveWorkBook.Name.

This can be achieved by making a *Custom Class* using a *Class Module*. The solution is somewhere on an MVP website or J.Walkenbach etc. Not sure where. Do a Google search for those terms.
 
Upvote 0
I have J. Walkenbach's book and I already have a class module for trapping events. I use it to trap the before_print event. I will give that a try.

Thanks,
Vlip
 
Upvote 0

Forum statistics

Threads
1,203,071
Messages
6,053,375
Members
444,658
Latest member
lhollingsworth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top