Cannot run the macro "filename1". The macro may not be available in this workbook or all macros may be disabled.

I've working on Macro Function (by VBA) which is in Excel.

When I create macro function and register function directly on toolbar(ribbon?),
the macro doesn't have any problem to run.

but the problem is happing,
when i close file and excel completely, and i open new file with other name and try to run the macro by pressing macro button, it keeps showing error below.

Cannot run the macro "filename1". The macro may not be available in this workbook or all macros may be disabled.

i've enabled macro setting as "allow all macro enabled"..

what am i supposed to change or add it.?

Also, I need the macro button available for 1 or 2 users in Active directory as well.

Thanks in advance
Who is Participating?
ArgentiConnect With a Mentor Commented:
Your macro IS VBscript code.
When you record a macro, VB script code is generated.

It looks that something triggers a call to open a file called Book2.htm. Something, somewhere tries to open that file, it doesn't find it, so it shows an error message.
ArgentiConnect With a Mentor Commented:
Hi there,

First of all, what is your Office (Excel) version?

Second, when you create your macro function you are given a list of choices on where you want your Macro to be saved. By default it's saved in your current workbook. That means your Excel file will contain your macro function. So if you want to use it in another Excel file, then you must have the original file opened so that Excel can access your macro function.
Another option when creating your macro would be to chose to save your macro in your Personal Macro Workbook, which is a file stored in your windows profile, then your macro will be accessible to any of your Excel open files.
ndoorsinteractiveAuthor Commented:
Thanks for your comments.
I've registered personal.xlsd file in C:\Users\USERNAME\AppData\Roaming\Microsoft\Excel\XLSTART

Now, it starts automatically whenver excel opens.
but, I still get this error (attached file)
i'm not what problem is. is it problem on VBscript..?

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

ArgentiConnect With a Mentor Commented:
Please open your Visual Basic Editor (Developer tab) then open the source code of the macro you have registered in your Personal.xlsb file. Check the code content and see if there is somewhere a call to open Book2.htm. If you find that line, please remove it, then save and close your macro.
ndoorsinteractiveAuthor Commented:
Is it problem beacause of inside VBscript code.?
I don't see any Book2.htm or .htm naming code inside of it.
ndoorsinteractiveAuthor Commented:
I've resolved it. I copied script and place into new module
that it works.

Thanks for your followup
You're welcome.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.