Home

Workbook_Open() fails to open

%3CLINGO-SUB%20id%3D%22lingo-sub-218050%22%20slang%3D%22en-US%22%3EWorkbook_Open()%20fails%20to%20open%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-218050%22%20slang%3D%22en-US%22%3E%3CP%3EI%20built%20a%20macro%20that%20uses%20the%20function%20Workbook_Open()%20and%20then%20executes%20stuff%20which%2C%20as%20I%20understand%20it%2C%20should%20kick%20off%20as%20soon%20as%20the%20spreadsheet%20it%20opened.%26nbsp%3B%20I've%20saved%20the%20spreadsheet%20as%20.xlsm%20and%20I%20can%20run%20the%20macro%20manually%20but%20it%20doesn't%20run%20itself%20when%20the%20spreadsheet%20is%20opened.%26nbsp%3B%20I%20think%20the%20spreadsheet%20was%20originally%20created%26nbsp%3Busing%202003%20and%20I'm%20using%20it%20in%202010.%26nbsp%3B%20Could%20that%20be%20the%20problem%3F%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-218050%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMacros%20%26amp%3B%20VBA%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWorksheet_Open%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-333088%22%20slang%3D%22en-US%22%3ERe%3A%20Workbook_Open()%20fails%20to%20open%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-333088%22%20slang%3D%22en-US%22%3EHello!%20Pls.%20Check%20your%20security%20options%20in%20that%20workbook.%20Go%20to%20%E2%80%9EFile%E2%80%9C-Tab%E2%80%94Options%E2%80%94%20Trust%20Center.%20There%20you%20can%20check%20it.%20If%20macro%20options%20grayed%20out%2C%20you%20don%E2%80%99t%20have%20permission%20to%20change%20it.%20Greets%2C%20Eva%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-758574%22%20slang%3D%22en-US%22%3ERe%3A%20Workbook_Open()%20fails%20to%20open%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-758574%22%20slang%3D%22en-US%22%3E%3CP%3ESome%20other%20ideas%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMake%20sure%20the%20sub%20is%20within%20the%20%22ThisWorkbook%22%20module%20and%20called%20exactly%20%22Private%20Sub%20Workbook_Open()%22.%20Not%20in%20another%20module%2C%20form%2C%20worksheet%2C%20or%20class%2C%20and%20obviously%20on%20the%20correct%20workbook.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%22Application.EnableEvents%20%3D%20False%22%20turns%20off%20events.%20If%20this%20is%20ran%20on%20another%20workbook%20it%20will%20stop%20your%20workbook%20from%20running%20it's%20%22Workbook_Open%22.%20Make%20sure%20this%20is%20on.%3CBR%20%2F%3E%3CBR%20%2F%3E%22Workbook_Open%22%20still%20needs%20macros%20to%20be%20enabled%20to%20run.%20The%20trust%20center%20options%20defines%20how%20these%20act%20but%20as%20best%20practice%20should%20be%20set%20to%20always%20warning.%20There%20are%20further%20additions%20from%20a%20development%20end%20to%20make%20sure%20there%20is%20a%20%22splash%20screen%22%20so%20the%20user%20can%20not%20use%20the%20tool%20till%20macros%20are%20enabled%20if%20need%20be.%3CBR%20%2F%3E%3CBR%20%2F%3EHope%20one%20of%20these%20help%3F%3C%2FP%3E%3CP%3EAlistair%20Blades%20-%20BespokeExcel%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F167487%22%20target%3D%22_blank%22%3E%40JIM%20SNYDER%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
JIM SNYDER
Occasional Visitor

I built a macro that uses the function Workbook_Open() and then executes stuff which, as I understand it, should kick off as soon as the spreadsheet it opened.  I've saved the spreadsheet as .xlsm and I can run the macro manually but it doesn't run itself when the spreadsheet is opened.  I think the spreadsheet was originally created using 2003 and I'm using it in 2010.  Could that be the problem?  

2 Replies
Hello! Pls. Check your security options in that workbook. Go to „File“-Tab—Options— Trust Center. There you can check it. If macro options grayed out, you don’t have permission to change it. Greets, Eva

Some other ideas;

 

Make sure the sub is within the "ThisWorkbook" module and called exactly "Private Sub Workbook_Open()". Not in another module, form, worksheet, or class, and obviously on the correct workbook.


"Application.EnableEvents = False" turns off events. If this is ran on another workbook it will stop your workbook from running it's "Workbook_Open". Make sure this is on.

"Workbook_Open" still needs macros to be enabled to run. The trust center options defines how these act but as best practice should be set to always warning. There are further additions from a development end to make sure there is a "splash screen" so the user can not use the tool till macros are enabled if need be.

Hope one of these help?

Alistair Blades - BespokeExcel

 

@JIM SNYDER 

Related Conversations
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
Edge insider Dev bypasses IE mode website list
HotCakeX in Enterprise on
4 Replies