Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

Calling a Macro in Com Addin on msocontrolbutton.onaction

$
0
0

I am developing a com Add In For Word 2007.

I am trying to create a popup menu and each control button in that is calling a macro present inside the same ThisAddin Class.

But in word when i click on the control button in popup menu  i get the following error :

"The macro cannot be found or has been disabled because of your macro
security settings"

I have tried a lot of search but unable to get any related info. so i think it might not be a issue at all or not a feature at all.

The code for menu generation is as below :

cbrCmdBar = MyWordAddIn.Globals.ThisAddIn.Application.CommandBars.Add(Name:="MyPopup", Position:=Office.MsoBarPosition.msoBarPopup, MenuBar:=False, Temporary:=True)

                With cbrCmdBar.Controls
                    With .Add(Type:=Office.MsoControlType.msoControlButton)
                        .Caption = "Point"
                        .OnAction = "StopPoint"
                        .FaceId =  70
                    End With
                End With
 

          And the macro is :

  Public Sub StopPoint()
        MsgBox("Popup Control Button Selected")
    End Sub

On the other hand , if i put the macro in template of the ActiveDocument It works fine.

Please help.



Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>