Enable macro in Excel

RobSA

Board Regular
Joined
Sep 2, 2012
Messages
91
Hi Folks,

I have created macros, in an excel workbook, that when action-ed, give me the error, macros are not enabled or not available in this workbook.
I have gone through all the "trusted setting" and made the adjustment accordingly, however the problem remains.
I would appreciate your inputs that I can get past this impasse.

Regards
Rob
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Exactly what adjustments did you make?
 
Upvote 0
Hi Rory,
Thanks for the response.
  • Excel allows you to go to the Trust Center Settings and make changes in order we can enable macros - this was done.
  • It allow one to also create a trusted location, that this request for enablement is a permanent one, based on files being stored in a certain location. This was also done.
  • It was suggested I create a dummy file under these conditions and close all Office software. Then delete the file, sometimes the old information remains, and thus this was all done and a reboot done.
these were the changes that I have effected to allow the macros to work.
 
Upvote 0
How are you running the macros?

Also, please note the forum rules on cross-posting and follow them in future. Thanks.
 
Upvote 0
Hi Rory,

Thank you for the reply.

I have developed a ribbon, and in the ribbon I have a line with code that says onAction="macro1.OpenWord"
When I select the respective icon, I get the error explained in previous posts.

Apologies - I did not mean to cause drama. I thought I would get an answer sooner by spreading the information on different forums. I will cease from doing so.
 
Upvote 0
Please read the rules. They clearly state that you can cross-post but you should provide the links.

Is your module really called macro1??
 
Upvote 0
Hi Rory,

Thanks for the heads up -I will endevour to follow the rules - thank you for adding the cross link reference for me.

I have two modules Module1 and Module3

the code in Module1 apprears as follows:

VBA Code:
Sub Macro_1()
Dim WordDoc As Object
Set WordDoc = CreateObject("Word.Application")
WordDoc.Documents.Open "C:\Users\User\Desktop\EPOCH_01_INDEX_2020.docx"
WordDoc.Visible = True
End Sub

The code used to action the macro is as follows:

VBA Code:
<menu id="Menu33" imageMso="SmartArtOrganizationChartRightHanging" label="Procedures" size="normal">
                        <toggleButton id="Togglebutton287" imageMso="SaveAsRichText" label="QM 01   - Index" onAction="Macro1.OpenWord"/>

It is perhaps where I am going wrong
 
Upvote 0
Then your onAction should be "Module1.Macro_1" and not "macro1.OpenWord"
 
Upvote 0
Thanks again for the reply and correction in code.

i have made the change with the resultant error.

"Wrong Number of arguments or invalid property assignment"
 
Upvote 0
Sorry, I forgot this is a callback, so your macro would need to look like this:

Code:
Sub Macro_1(ByVal control as IRibbonControl)
Dim WordDoc As Object
Set WordDoc = CreateObject("Word.Application")
WordDoc.Documents.Open "C:\Users\User\Desktop\EPOCH_01_INDEX_2020.docx"
WordDoc.Visible = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top