Hello
This is in continuation of the above question
I am discussing the steps i have implemented
1. I save the macro file as .xlam
2. In Custom UI Editor i created the xml file to add menu item
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI xmlns="
http://schemas.microsoft.com/office/2006/01/
customui">
<ribbon>
<tabs>
<tab id="CapPlanID" label="Capacity Planning">
<group id="CapPlanGrp" label="Capacity Planning">
<button id="CapPlan" label="Capacity Planning"
onAction="VBAMacros_USE_v0.2.xls!BtnOnActionCall" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++
3. In the VBA on the worksheet load page i wrote the code
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++
Option Explicit
Const RibbonxAddin As String = "VBAMacros_USE_v0.2.xlam"
Private Sub Workbook_Open()
MsgBox ThisWorkbook.Path & "\" & RibbonxAddin
If Val(Application.Version) > 11 Then
If Dir(ThisWorkbook.Path & "\" & "VBAMacros_USE_v0.2.xlam") <>
"" Then
Workbooks.Open ThisWorkbook.Path & "\" &
"VBAMacros_USE_v0.2.xlam"
Else
MsgBox "The RibbonX add-in (" & "VBAMacros_USE_v0.2.xlam"
& " is not in the same folder as this workbook." & vbNewLine & _
"The custom Ribbon tab cannot be created without
it."
End If
Else
CreateMenu
End If
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Val(Application.Version) > 11 Then
On Error Resume Next
Workbooks("VBAMacros_USE_v0.2.xlam").Close False
Else
DeleteMenu
End If
End Sub
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++
Also Created modules
+++++++++++++++++++++++++
mRibbon
Sub BtnOnActionCall(Ctrl As Variant)
Dim Ctrl1 As IRibbonControl
Set Ctrl1 = Ctrl
Select Case Ctrl1.ID
Case "CapPlan": ThisWorkbook.CreateMenu
End Select
End Sub
+++++++++++++++++++++++++++++++++++++++
Kindly tell me where i am going wrong.
Thanks