Hi All,
I have been working on adding a right click macro, and while I think I have it correctly, it seems to be getting blocked with a message stating macros are disabled. However running either macro below run without issues, so I'm not sure what seems to be my issue:
Any advice would be greatly appreciated.
I have been working on adding a right click macro, and while I think I have it correctly, it seems to be getting blocked with a message stating macros are disabled. However running either macro below run without issues, so I'm not sure what seems to be my issue:
VBA Code:
Sub AddToCellMenu()
Dim ContextMenu As CommandBar
Dim MySubMenu As CommandBarControl
'Delete the controls first to avoid duplicates
Call DeleteFromCellMenu
Set ContextMenu = Application.CommandBars("Cell")
'Add one custom button to the Cell menu
With ContextMenu.Controls.Add(Type:=msoControlButton, before:=1)
.OnAction = "tryopen"
.FaceId = 59
.Caption = "~~Open This File~~"
.Tag = "My_Cell_Control_Tag"
End With
'Add seperator to the Cell menu
ContextMenu.Controls(4).BeginGroup = True
End Sub
Sub tryopen()
FolderName = ActiveCell.Value
Shell "C:\WINDOWS\explorer.exe """ & FolderName & "", vbNormalFocus
End Sub
Any advice would be greatly appreciated.