Link to home
Start Free TrialLog in
Avatar of mlagrange
mlagrangeFlag for United States of America

asked on

Getting "Object variable...not set" on ActiveWorkbook after "Enable Editing"

Hello - in the Workbook_Open event, I do some initialization things like protecting the workbook, protect the individual worksheets, and hide some columns on a data input worksheet.

I was ready to roll this out, but when I changed the workbook file name, the first time opening it, everything stopped until I answered the prompt about "Enable Editing". After I click that button, then I get the Object variable... not set".

Shouldn't ActiveWorkbook always be set?

Thanks
Avatar of COACHMAN99
COACHMAN99

what line of code triggers the error?
Avatar of mlagrange

ASKER

ActiveWorkbook..Unprotect Password = strMyPassword

I unprotect the workbook first in case it is still protected, so I can hide tabs that may or may not be hidden.
strMyPassword is Dim'd as: Global Const strMyPassword as string = ...
ASKER CERTIFIED SOLUTION
Avatar of Bembi
Bembi
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, thanks, that explains it. As it turns out, I'm lucky; this thing will live on SharePoint, and it doesn't have this problem opening up from there.

Thanks again