Solved

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

Posted on 2014-04-07
4
350 Views
Last Modified: 2014-04-08
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
0
Comment
Question by:mlagrange
  • 2
4 Comments
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 39984348
what line of code triggers the error?
0
 

Author Comment

by:mlagrange
ID: 39984388
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 = ...
0
 
LVL 35

Accepted Solution

by:
Bembi earned 500 total points
ID: 39984412
In general yes..., but....
As you open a workbook from a "non trusted" location, the question is what happens first.
The behaviour of macros depend on the security settings for the client (if excel is allowed to proceed macros in general) and second on the location, where they are stored.
If Excel opens a file from a "non trusted"location, everything is blocked first until you agree to open it. If the macros are allowed to run at this time, the macro can not find the object, as it was blocked before.

So you have to make sure, that the macro is allowed to run and that excel recognized the file location as trusted before it tries to open it.

Thruste file locations can be set in the security settings (Excel) on the local machine or you can setup GPOs to define truted locations.
0
 

Author Closing Comment

by:mlagrange
ID: 39985813
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
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now