Forcing User to select "Enable Macros"

B

bstobart

In other Office applications one way in VBA to force the user to select
"Enable Macros" is to make it unpleasant for him/her not to make this
selection. For example, when closing a project, you can have a macro hide or
password protect some data that the user will need. The Open event will
automatically unhide or unprotect such data (or views) as long as the user
selects "Enable Macros".

I'm new to VBA with Project. Do you all have any suggestions for what I
might hide, or password protect to "gently" encourage my users to choose
"enable macros"?
 
J

John

bstobart said:
In other Office applications one way in VBA to force the user to select
"Enable Macros" is to make it unpleasant for him/her not to make this
selection. For example, when closing a project, you can have a macro hide or
password protect some data that the user will need. The Open event will
automatically unhide or unprotect such data (or views) as long as the user
selects "Enable Macros".

I'm new to VBA with Project. Do you all have any suggestions for what I
might hide, or password protect to "gently" encourage my users to choose
"enable macros"?

bstobart,
In Project you cannot selectively password protect data. Either the
whole file is password protected or it's not. You could have an event
macro (i.e. Open or Close) encode and decode some data but that's not
necessarily foolproof either.

What exactly is your end goal? With more complete information, it will
be easier to help you (or tell you you can't get there from here).

John
Project MVP
 
B

bstobart

There may be a number of things that I'd like to do with macros. Here are
two examples:
1) I have created a macro that enforces a rule that users may not directly
edit the start or finish date of a task, unless the duration of the task is
zero.
2) I may automatically populate certain fields on the basis of other field
entries.

If macros are not turned on, a number of extensions would be turned off,
some of which might be crucial.
 
J

John

bstobart said:
There may be a number of things that I'd like to do with macros. Here are
two examples:
1) I have created a macro that enforces a rule that users may not directly
edit the start or finish date of a task, unless the duration of the task is
zero.
2) I may automatically populate certain fields on the basis of other field
entries.

If macros are not turned on, a number of extensions would be turned off,
some of which might be crucial.

bstobart,
Although you may be able to "force" users to do or not do certain
things, a much better approach is through training. At the company where
I worked we had extensive training both about how to use Project itself
and also how to use Project within our corporate and customer structure
(formal certified earned value system). In addition to the classroom
training, we also had a set of corporate macros the were required for
certain aspects of the process. In order to make it easier for the users
to comply with our process, I wrote some utility macros and installed an
Open Event macro in each user's project file that added a customized
toolbar with buttons for running each utility macro.

As far as insuring that users ran the required check macros during file
planning, updating and statusing, we used two audit methods. Upon
successful completion of running the checking macros, the code
automatically logged an entry into an Excel spreadsheet so we could tell
when the file was ready for data integration with our financial system.
Then, before the project data was actually uploaded, our business people
ran a separate audit macro.

The process worked well. Our users were trained and, they were given the
tools and personal assistance to make their jobs easier - at least when
it came to using Project. And with our audit process, errors were few
and far between.

John
Project MVP
 
J

Jan De Messemaeker

Hi,

I think your basic idea is very good, forcing people is sometimes good for
them :)
But if Macro Security is High, will an On Open macro even work?
If yes, my slightly sadistic character easily comes up with some jucy ideas
like setting the font of all tasks to white or apoplying a table with only
zero width fields..

Hope this helps,
 
J

Jim Aksel

Cruel. But very very nice. As we say in America -- You are twisted.
You should consider that an honor.
 
J

Jan De Messemaeker

Thanks.
But I'm not going to try it, but from memory, unfortunately when Security is
high, On Open event macro's don't fire.
 
J

Jim Aksel

Did you try adding the reference MSPRJ.OLB in the Program Files/Microsoft
Office/OfficeXX/ folder? (XX is either 11 or 12 depending on your version).

Project/Add Reference/ COM tab from VS2005.

In your project:
dim pj as New Microsoft.Office.Interop.MSProject.Application (same key words
in C#)
--
If this post was helpful, please consider rating it.

Jim

Visit http://project.mvps.org/ for FAQs and more information
about Microsoft Project
 
J

Jack Dahlgren

I think your recollection is correct.
The idea is to not allow files to set the security level - otherwise what
purpose is there for having the security level in the first place?

-Jack Dahlgren
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top