MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Delete a auto_open macro from a file throug another file

  Asked By: Clifton    Date: Mar 25    Category: MS Office    Views: 1130

Here is a little problem in macro writing.

Basically I want to delete an auto_open macro from a file through
another file macro.

Is it possible?

If anybody can do help me, please write.

I will be very thankful to those.



5 Answers Found

Answer #1    Answered By: Horia Ahmed     Answered On: Mar 25

Yes, it is possible to access the VBA area of a workbook and modify the
programs. I did it once, a long time ago, but don't have any record of what
I did.

I do recall that finding out how was as simple as Googling for the

Answer #2    Answered By: Sophie Williamson     Answered On: Mar 25

I don't think there is a way to remove ONLY one sub (in this case Auto_Open)
But there IS a way to remove a macro  Module.
Now, if you make sure that all of the subs in a given Module can be deleted
(or move all subs except Auto_Open to another Module)
then you can remove the single module.

Now, why do you want to remove it?
Wouldn't it be simpler to have it test for certain conditions and only run
if the conditions are met?
(Like, only run if the file  is called "ThisFile.xls" and is located in
"D:\ThisPath" ??)

Answer #3    Answered By: Hattie Howard     Answered On: Mar 25

Thanks for your concern.

basically I have some reports those auto_open  macro.

by this macro  I need to copy some calculation result in another column before
the calculation.

because this report run on daily basis and i need to hold pervious %age for

when I publish this reports to concern than I need to delete  this macro before

this is reason for deleting the macro.

Answer #4    Answered By: Adanalie Garcia     Answered On: Mar 25

What I've done is have the Auto_Open macro  first determine the current user's
Then, if it is not "MY" ID, I exit the macro.

Again, though... when you "publish" the reports, are you placing the file  in
another location?
Renaming to another name?

If so, you can have the Auto_Open macro only run if the file name is a specific
name, or
the file is located in a specific folder.

Answer #5    Answered By: Ginger Snyder     Answered On: Mar 25

I don't have this information any more.

But I just did a Google search. My keywords: excel vba modify program
modules from code

This hit http://www.cpearson.com/excel/vbe.aspx looks promising.

Didn't find what you were looking for? Find more on Delete a auto_open macro from a file throug another file Or get search suggestion and latest updates.