run-time error '91' object variable or block variable not set

TRosseter

New Member
Joined
Jul 26, 2013
Messages
22
when I open up the spread sheet aiiwwaxexcel0 the code runs fine and all is good but if I open up any other or new workbook I get this run time error any ideas?

code below
'Private Sub Workbook_Open()
'Select Case ActiveWorkbook.Sheets("aiiwwaxexcel0").Range("A3").Value
'Case "History"
'History_Order_Guide_Without_Pricing2
'Case "ItemBrowse"
'Order_Guide_With_Pricing2
'Case Else
'End Select
'End Sub
 
any time you open up excel this code runs this is why is in this file. I use personal.xlsb which is a hidden template on the computer and accessible to any excel document when opened.when I export an excel document from my software it creates a file "aiiwwaxexcel0" then I can manually run a macro from my personal file. already using this and it worked just fine. i'm trying to automate it now for anyone that opens up an excel document it auto runs a macro bases on info in "a3". this ensures the correct macro runs as I have multiple macro that does different things to the excel document.
 
Upvote 0
This code will run whenever personal.xlsb opens, not when other workbooks open.

personal.xlsb is opened every time you open Excel, so the code will run every time you open Excel.
 
Upvote 0
yes, every time you open excel, runs through a case and if false it exits, if there is a match then it runs a macro.
 
Upvote 0
Every time Excel opens it runs that code.

That code looks for a worksheet called 'aiiwwaxexcel0'.

If it doesn't find that worksheet then the code errors.
 
Upvote 0
So the code is doing what it's supposed to then?
 
Upvote 0
only if it finds the info in the "a3" all others get the global error message. you can always click end and go to your excel document.
 
Upvote 0

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