Free Microsoft Excel 2013 Quick Reference

cannot run the macro, This macro may not be available in this workbook

I have an excel based project. I have a GUI which I use to load, save etc. I have added buttons to the worksheet
Private Sub HomeSheet(ByVal Pattern As Excel.Worksheet)
 Dim HomeButton, NextButton, PreviousButton As Object

        PreviousButton = Pattern.Buttons.Add(0, 50, 100, 50)
        HomeButton = Pattern.Buttons.Add(150, 50, 100, 50)
        NextButton = Pattern.Buttons.Add(300, 50, 100, 50)
        HomeButton.Caption = "Home"
        PreviousButton.Caption = "Previous"
        NextButton.Caption = "Next"

        HomeButton.Enabled = True
        PreviousButton.Enabled = True
        NextButton.Enabled = True

        HomeButton.Locked = False
        PreviousButton.locked = False
        NextButton.locked = False
        '
        HomeButton.OnAction = "SelectHomeSheet"
        PreviousButton.OnAction = "SelectPreviousSheet"
        NextButton.OnAction = "SelectNextSheet"
I have a module in my project titled macros which houses the public functions SelectHomeSheet, SelectHomeSheet and SelectNextSheet. However when I run my code, the buttons generate but when I click on them I can an error
Cannot run macro ".....". This macro may not be available in this workbook or macros are disabled.
What Do I have to do to correct this?
Cheers in advance


Post your answer or comment

comments powered by Disqus
After creating and assigning macro buttons i keep getting cannot run the macro may not be available in this workbook or all macros may be disabled.

I am getting the following error in Microsft Excel 2007 / Windows 7 when attempting to use an add-in I have installed. It used to work in Excel 2003, but does not any longer:

"Cannot run the macro "C:Douments and SettingsEnduserApplication DataMicrosoftAddInsEATickmarks.xla'!FormatRedL'. The macro may not be available in this workbook or all macros may be disabled."

I have attached a screenshot - it looks like the path of where addins were stored previously does not match up correctly. How do I manually change the path that an item in the add-in "calls" when I click on it from the ribbon?

Thanks,
Chris

I have an xlam addin file. A few minutes ago it was working fine.
I open the addin file and my spreadsheet.xlam
The xlam file adds a ribbon. I click on a button and get:
Cannot run the macro 'Validate' ...may not be available...or all macros
may be disabled.

If I open up Visual Basic, I can run the macro and it works.

Excel Options>Add-Ins, I don't even see my add-in...
(but the ribbon is there...)
Excel Options>Trust Center
>Macro Settings
o Enable all macros
x Trust access to the VBA project object model
>Add-Ins
nothing is checked, neither Require... nor Disable...

In the addin Excel Object
IsAddin = True

Why doesn't it work? I guess I should reboot and see if that fixes it...

Hey there...I have two macros in an add-on that's loaded when I go into Excel. They are stored in two separate modules, both are public subroutines. If I open Excel and go to the Project Explorer, I can see the modules/subs in the XLA file and can run them from there without an issue.

When I open an XLS file and try calling the macros using VBA, I get the dreaded "Cannot run the macro..." message. Macros are fully enabled and I believe the XLA file is also stored in a "trusted" area.

This appears to be a common issue, however I haven't found a solution that is mine. The macro call is actually happening from within SAS using DDE (the XLS file is opened, and then the [run("<macro name>")] command is invoked. I've tried updating it to <name_of_XLA_file>!<name_of_macro> but that did not help. As I said, I can go into the VBA explorer and run the macros from within there and they run fine. Running them from SAS has also worked in the past...trying it out for the first time in a few months and now running into these issues.

Any ideas on what I can try? The macros create graphs, resize them, convert them to png files, then saves the png on a separate tab. It also formats a data listing on another tab. Nothing too fancy...no parameters.

Thanks!

ACC2000: DoEvents, SendKeys May Not Be Supported in Custom Functions

Under certain circumstances, DoEvents and SendKeys are not supported when called by user-defined (custom) functions in Visual Basic for Applications. DoEvents and SendKeys are not ...

I opened up an Excel 2003 workbook using Excel 2007.

After clicking on a macro the following message appeared ... Cannot run the macro “vbapractice.xls!’accessLEAPdataworksheet!. The macro may not be available in this workbook or the macro might be disabled. ... .

How do you enable the macros in Excel 2007 so they will engage?

Thanks for your time and help,
Tom

Hey guys,

I'm new VBA but not to programming...yet every once in a while, I find an eror that just throws me.

I have worked through a project I'm doing for a comapny that was written by someone else and I had most of it working, but after running a short while it would throw an error -- "Cannot run macro 'OnLoad'. The macro may not be available in this workbook or all macros may be disabled."

I have macros enabled. I have looked through as much code as I can so far and have not ONCE found a macro named "OnLoad".

Google has no answer. Yahoo has no answer. MS Support has no answer (not surprising....).

Hopefully you can help me...

Thanks for anything!

Hello all!

I've created a VBA script for Timer to call the function itself repeatedly, but I'm having some issues regarding the macro setting. I already have checked the macro security (Trust Center Setting). I enabled all options and then I saved the sheet. Reopened it and ran the script, but getting the same error.

I am using Excel 2007

Here is the message:

"Cannot run the macro "C:test.xlsm!TimerA". The macro may not be available in this workbook or all macros may be disabled."

Here is the code in Sheet1


	VB:
	
 TimerA() 
    Application.OnTime Now + TimeValue("00:00:30"), "TimerA" 
End Sub 

If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
I hope you can solve this problem for me

Thanks
Bryan

I have a shared workbook with information for 2 different floors in our facility. One floor will start one macro (5th) and the other floor will start macro (6th). The 5th works great but I get this error with the 6th

Cannot run the macro (then its name). The macro may not be available in this workbook or all macros may be disabled?

Any ideas on what I am doing wrong?

Hi all,
Can anyone tell me why this macro won't work:

Sub Instructor()

Application.Run
"'Macros.xlsm'!Pt4"
Application.Run "'Macros.xlsm'!Pt5"
Application.Run "'Macros.xlsm'!Pt6"
Application.Run "'Macros.xlsm'!Pt7"
Application.Run "'Macros.xlsm'!Pt8"
End Sub
The macro actually keeps going up until Pt19.

I get the error:

Run-time error '1004':
Cannot run the macro "Macros.xlsm'!pt4'. The macro may not be available in this workbook or all macros may be disabled.

However, I'm sure macros are enabled and each of the the individual macros (Pt1, Pt2...) run in the workbook individually

Any help greatly appreciated

Hi,
I have this sub:
Sub ShowForm(frmName)
frmName.Show
End Sub

From another sub which is attached to the OK button of a form, I pass the form name as an argument. But I get an error saying that "the macro ShowForm() can not be found."

The only way I can get the form to display is to remove the arguments and just have the parentheses.

Can I not pass arguments from macro to macro????

Here is the portion of the code attached to the OK button:

newMenuItem.Caption = "Adjust the Schedule"
newMenuItem.OnAction = "ShowForm(frmAdjustSchedule)"

The objective is to show the form when the menu item is clicked by passing the form name as an argument to the ShowForm macro. That way, I don't have to write a ShowForm() macro for each different form called by the menu items. Thus, bloating my code.

Any help would be greatly appreciated!

I am not that familar with VB in Excel, though I could manage to write/copy
the code for running the macro when we give a password in the MSG Box. Here
what like to know is How to make the charaters not to be displayed instead it
should display ****** as usual practice for passwords. Thanks inn advance for
immediate help.

Hi,

I want to run a macro that simply moves data from one row
to an area of the worksheet that keeps track of completed
items. What I need is a statement that does something
like this:

=IF(b1="",do nothing, run move macro).

How do I tell the =IF function to run the macro? This
seems to be a pretty easy thing to go yet the Help does
not address it.

Thanks,

Bob

Hi,

I want to run a macro that simply moves data from one row
to an area of the worksheet that keeps track of completed
items. What I need is a statement that does something
like this:

=IF(b1="",do nothing, run move macro).

How do I tell the =IF function to run the macro? This
seems to be a pretty easy thing to go yet the Help does
not address it.

Thanks,

Bob

Hi

I need some help with the below macro please.

The macro is working fine but what I want to change is the path for saving the file. The path that I would like it saved to is in the worksheet "NEW ORDER_" cell "N2"

Sub RENAME2()

   Dim strWbKill As String
   Dim myName As String
    
   myName = ThisWorkbook.Path & Application.PathSeparator 'copy to same folder that file is in
   myName = myName & Application.Cells(3, 7) & "_"  'cell G3 Style
   myName = myName & Application.Cells(3, 3) & "_"       'cell c3 Customer
   myName = myName & Application.Cells(10, 3) & "_"       'cell c10 PO Number
   myName = myName & Application.Cells(16, 4) & "_"        'cell d17 Colour
   myName = myName & Application.Cells(16, 3) & ".xlsM"    'cell c17 New/Repeat

    With ThisWorkbook
        strWbKill = .FullName
         ActiveWorkbook.SaveAs , Filename:=myName, FileFormat:=52
        
      End With
     
    Kill strWbKill

End Sub
I am new to the forum so this may not be filled in correctly, please let me know.

Thank you.

Hopefully someone can help me with this issue, as I am now completely lost ...

I'll try and explain it in simple terms..

I have 3 workbooks:
Workbook A
Workbook B
Workbook C

These each have one macro:
Workbook A - Macro 1
Workbook B - Macro 2
Workbook C - Macro 3

I can run Macro 1 from A, obviously, I can run it from B, but not from C.
I can run Macro 2 from B, again obviously, and I can run it from A, but not C.
I can run Macro 3 from C, but I can't run any of the others from C.

For some reason, whenever I try to run Macro 3 from either A or B, I get the error message:
Run-time error '1004': Cannot run macro . The macro may not be available in this workbook or all macros may be disabled.

The same error message appears if I try to run macro 1 or 2 from C.

My code is exactly the same in all workbooks so I know it's not the code. I have enabled all macros so I know that the disabled part isn't true.

Has anyone else ever came across this? Is there a tick box I have missed somewhere that does not let macros be run from another workbook?
I am totally lost with this as I see no difference in workbook C that I do with any of the other two.

Any help or input would be greatly appreciated.

This is the only site I have posted on, but I have asked our IT team if they have ever came accross this and no-one had. I also checked the microsoft website for any help and found nothing on there that was related.

Thanks in advance

I saved a macro in my personal.xlsb workbook. The macro works fine when I run it in the personal workbook, but when I try to run it for other workbooks (i.e. book1) I get the following message:

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

I'm running Office 2007 and I do have macros enabled in both workbooks (I can run other macros in book1).

Any help you can offer in this is appreciated.

Thank You!

Hi-

I have put the following simple code into a new module in my worksheet:

Public RunWhen As
Double
Public cRunIntervalSeconds As Double
Public Sub StartTimer()
    cRunIntervalSeconds = Worksheets("Signals").Range("Interval").value
    RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
    Application.OnTime EarliestTime:=RunWhen, Procedure:="Toggle", Schedule:=True
End Sub
Public Sub StopTimer()
    On Error Resume Next
    Application.OnTime EarliestTime:=RunWhen, Procedure:="Toggle", Schedule:=False
End Sub
Public Sub Toggle()
    Worksheets("Signals").Range("Toggle") = "TRUE"
    'Reschedule next run
    Call StartTimer
End Sub
It seems to schedule okay, but when 60 seconds is up (the interval value in Worksheets("Signals").Range("Interval").value) it gives the following error message:

"Cannot run the macro "...Toggle". The macro may not be available in this workbook or all macros may be disabled". However, i do have my trust center settings to enable all macros. Does anyone have any ideas what is going on? I'm stumped. Thanks.

I am trying to automate the account admin process on Network Servers.

When any admin runs the macros, the macro should be run with the
service account credentials rather than with the admin's username and
password.

The service account would have rights to do certain high level
activities.

Can this service account be embedded in code so that by default the
code is run with service account username and password.?

Hi Guys,

The following code has been provided on a prior thread to add macro option to 2003 but I cant get it to function fully in 2007 as I get the following message when the 'run my code' option is selected from the right click menu;

Cannot run macro "macro test 4.xlsm'!mymacroname'. The macro may not be available in this workbook or all macros may be disabled.

Thank you for any assistance... Kabes
Sub AddToCellMenus()

   Dim cbr As CommandBar, ctl As CommandBarButton
   For Each cbr In Application.CommandBars
      If cbr.Name = "Cell" Then
         Set ctl = cbr.Controls.Add(msoControlButton)
         With ctl
            .Caption = "run my code"
            .OnAction = "mymacroname"
            .Style = msoButtonCaption
         End With
      End If
   Next cbr
End Sub

Sub RemoveFromCellMenus()
   Dim cbr As CommandBar
   On Error Resume Next
   For Each cbr In Application.CommandBars
      If cbr.Name = "Cell" Then
         cbr.Controls("run my code").Delete
      End If
   Next cbr
End Sub

Sub mymacroname()

    MsgBox "help me..."

End Sub


[Solved]
I am using the function: Application.OnTime TimeValue to run a specific macro every day at 4:00 PM, but at 4:00 PM the macro tries to launch another macro but is disabled by Excel even though the macro security is set to allow it to run. If I run the “Sample_Macro_Name” manually, it runs just fine. However, as soon as I use the another macro to launch the “Sample_Macro_Name” at a specific time, when the that time occurs, instead it returns the error message:

"Cannot run the macro Sample_Macro_Name() The macro may not be available in this workbook or all macros may be disabled”

Excel version: Office 2010
Macro security: set to enable all macros to be run.
Workbook is saved as a macro enabled workbook in a “trusted file location” on my local drive.

I have tried placing the 2nd bit of code, the macro, in standard modules, worksheet modules, and ThisWorkbook module, but in every case the macro will not fire with the Application.OnTime function, but will always fire when I manually launch it. It is as if Microsoft does not allow timed macros to fire off at a certain time due to security, yet it can be manually launched.

1. Code in the ThisWorkbook module:


Private Sub Workbook_Open()
  'Runs a macro at 4:00 PM
   Application.OnTime TimeValue("16:00:00"), "Sample_Macro_Name()”
End Sub


2. Then in a regular module the code:


Sub Sample_Macro_Name()
  [Macro code goes here]
End Sub
Folks, I appreciate your wise guidance.

I'm trying to call a sub in an exce. file that resides on our network drive so that multiple users can access the programs that I develop and I can get VBA to open the file but I can't get it to open the sub titled "DCU". I keep getting the following error.
Cannot run the macro DCU. The macro may not be available in this workbook or all macros may be disabled. Here is my code that errors.
Code:
Option Explicit
Sub DESCRIPTION_CLEANER_UPPER()
Application.Visible = True
Workbooks.Open Filename:= _
        "Cansvp01grp_01fCommonCommon-PartsPrcngMacrosMacros.xls"
Application.Run "DCU"
End Sub
Any help is greatly appreciated, maybe I'm calling it wrong or maybe there's another way to accomplish what I'm trying to do here.

Code:
sub nextorders()
MsgBox "works!"
end sub

sub startTimer()
Application.OnTime Now, "nextorders"
end sub
This doesn't work for me!!
CANNOT RUN THE MACRO "D:BOOK1.XLSM'!NEXTORDERS'. THE MACRO MAY NOT BE AVAILABLE IN THIS WORKBOOK OR ALL MACROS MAY BE DISABLED.

wth?? All macros are enabled on Excel 2007, what's the problem??
thank you

Hello Experts,

I have a macro with "ActiveWorkbook.Protect Password:="password"" . It was working fine in excel 2003. In excel 2007, because of this I am not able to run any macro's in the workbook. I am getting a message "The macro may not be available in this workbook or all macros may be disabled. I can see a security warning in message bar saying macros have been disabled, but I dont have have a option to enable the macros.

Any help is greatly appriciated.

Lavan


No luck finding an answer? You could always try Google.