MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Auto_Open Macro

  Asked By: Qadriyah    Date: Jan 23    Category: MS Office    Views: 540

Is there a way to make sure the Auto_Run macro is run when you open a
workbook without having the user say "yes" or "no" to allowing Macros
to be run. I do not have a Certification so the XL security has to
be set to medium or Low in order to run macros.

In addition, how can you revise the workbook if the Auto_Run macro
changes the name of the file used by the user upon opening. My
intent is to have the user open the file and it automatically saves
the open file under a new temporary name to prevent the user from
changing the original file either accidentaly or deliberately.
Needless to say, someone has to have access to the original file to
make any necessary changes to it. If the original file is on a
server, multiple people can use this file at the same time because
once the name is changed the original file can be used by anyone else
since it would now be unused.

One way I can think of doing this, though not necessarily the best,
is to allow the macro to run. Once the macro has run and the user
has made any necessary changes to the template it could be saved
under the original template name.

Any other suggestions on how to do what is needed?



3 Answers Found

Answer #1    Answered By: Joel Brown     Answered On: Jan 23

The answer to your first question:
"Is there a way to make sure the Auto_run macro  is run... without ... "yes" or
is "NO"... the whole idea is to ensure that a file  that has a virus macro does
not run  without
the user  approving the macro. The certification  is to get past this. There is
a "selfcert" that has
limited utilization... but there's no getting past it. And, as a software
developer, and a victim of
viruses, I don't WANT it to be easily bypassed!!!

For your second question... Are you saying that your file renames itself after
the user opens it.
But you want specific users to be able to overwrite the original  file?
First of all, I ALWAYS make my changes in a "Development" file. The changes I
make are sometimes
extensive, and I may have to save the document at an incomplete condition. In
which case, I don't
want the user to call up the in-process file... Therefore, my auto_run macro
checks to see if the
current path name (activeworkbook.path) is the "Development" folder. If not,
then it proceeds with
the rest of the macro. I also have another "File_Release" macro that does a
"savecopyas" and overwrites
the "Released" file.. Tip: use .attributes=0 to set  the write flag on the
file, overwrite the file, then set
the attributes = 1 in order  to make it read-only for the users. That way, the
users cannot have the file
open when you're trying to overwrite it.

Answer #2    Answered By: Noel Peterson     Answered On: Jan 23

Thanks for the tips and ideas. I didn't think of putting the finished file
in a separate directory that the user  can access  and keep a working copy in
some other directory so it can be worked on by the authorized people or
person. What you are saying makes it easy to do what I need to do.

I agree that you don't want some virus macro, or unauthorized macro  to run
on the computer. The reason I asked about shutting off the request is that
I was asked by another person who said he didn't even want the users to know
that a macro was running. I can see his point, but I also see and agree
with yours. If a user opens the file  up he should be aware of what is
needed to run  it, otherwise he probably shouldn't be using it anyway.

Thanks again for the information and I will put it to good use. It just
shows that there are many ways to do something and I don't always think of
the best, or easiest, one to use.

Answer #3    Answered By: Iqbal Bashara     Answered On: Jan 23

If what you're doing is ONLY on a Local Area Network (not downloadable or
otherwise available outside your network) then it MAY be possible to create a
Look up documentation on a program called SelfCert (I think).
I've not used it myself, but from what I've read from others, it would be a way
of certifying your macros  within your organization. Which would then allow the
macros to be run  without the prompt.

Keep in mind that I have no personal experience with this. I happened to be
looking a it to solve another problem, which it did not do, but I recognized the

Didn't find what you were looking for? Find more on Auto_Open Macro Or get search suggestion and latest updates.