Hi,

I have written a MS word COM add-in using vb6, which creates a menu item and
invokes the add-in when it is clicked.

It works on several of our PCs but on one users machine it always gives the
following error when he tries to select the menu item:

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

we have tried setting his macro security to low and still to no avail (mine
is set to high and the plugin still works fine). he is using NAV but has
disabled the office integration (and has also tried disabling the whole of
NAV) but again he just gets the same error. All the PCs are using office
2003.

I am using an add-in designer and have set the OnAction property of the
CommandBarButton to "<!xxx>" where xxx is the progid of the designer. I
can't beleive I have done anything wrong with the code because as I say it
works on several other PCs. we can invoke the same progid via vbscript so I
know everything is registered correctly

does anyone have any clues for the next thing to try?

Andy

Re: macro security error trying to invoke a plug-in by Jezebel

Jezebel
Wed Mar 29 22:14:29 CST 2006

One thought: having changed the security setting, you need to restart Word.

This line is disconcerting: "I can't beleive I have done anything wrong..."
Spelling aside (oh the irony!), for a programmer, this assertion is just
folly.







"Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
news:%23Y78f$yUGHA.6112@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I have written a MS word COM add-in using vb6, which creates a menu item
> and invokes the add-in when it is clicked.
>
> It works on several of our PCs but on one users machine it always gives
> the following error when he tries to select the menu item:
>
> "The macro cannot be found or has been disabled because of your macro
> security settings"
>
> we have tried setting his macro security to low and still to no avail
> (mine is set to high and the plugin still works fine). he is using NAV but
> has disabled the office integration (and has also tried disabling the
> whole of NAV) but again he just gets the same error. All the PCs are using
> office 2003.
>
> I am using an add-in designer and have set the OnAction property of the
> CommandBarButton to "<!xxx>" where xxx is the progid of the designer. I
> can't beleive I have done anything wrong with the code because as I say it
> works on several other PCs. we can invoke the same progid via vbscript so
> I know everything is registered correctly
>
> does anyone have any clues for the next thing to try?
>
> Andy
>
>



Re: macro security error trying to invoke a plug-in by Andy

Andy
Thu Mar 30 14:29:56 CST 2006

well, I've tried reinstalling office and uninstalling norton on the affected
PC but to no avail - exactly the same error.

have also tried it on several more PCs which all work fine (this is why I'm
convinced the code is Ok), so I'm no nearer the solution :-(


"Jezebel" <warcrimes@whitehouse.gov> wrote in message
news:uFF1xB7UGHA.6084@TK2MSFTNGP14.phx.gbl...
> One thought: having changed the security setting, you need to restart
> Word.
>
> This line is disconcerting: "I can't beleive I have done anything
> wrong..." Spelling aside (oh the irony!), for a programmer, this assertion
> is just folly.
>
>
> "Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
> news:%23Y78f$yUGHA.6112@TK2MSFTNGP10.phx.gbl...
>> Hi,
>>
>> I have written a MS word COM add-in using vb6, which creates a menu item
>> and invokes the add-in when it is clicked.
>>
>> It works on several of our PCs but on one users machine it always gives
>> the following error when he tries to select the menu item:
>>
>> "The macro cannot be found or has been disabled because of your macro
>> security settings"
>>
>> we have tried setting his macro security to low and still to no avail
>> (mine is set to high and the plugin still works fine). he is using NAV
>> but has disabled the office integration (and has also tried disabling the
>> whole of NAV) but again he just gets the same error. All the PCs are
>> using office 2003.
>>
>> I am using an add-in designer and have set the OnAction property of the
>> CommandBarButton to "<!xxx>" where xxx is the progid of the designer. I
>> can't beleive I have done anything wrong with the code because as I say
>> it works on several other PCs. we can invoke the same progid via vbscript
>> so I know everything is registered correctly
>>
>> does anyone have any clues for the next thing to try?
>>
>> Andy
>>
>>
>
>



Re: macro security error trying to invoke a plug-in by Andy

Andy
Fri Mar 31 09:48:03 CST 2006

FWIW here's what happened.

A trivial bug in the application caused a VB out-of-range error which wasn't
trapped. I thought nothing of it at the time (because this is just a buggy
prototype) but here's the strange thing:

The first time the add-in generates an untrapped exception, it will never be
invoked again (even if word is restarted, the machine rebooted or, as in
this case, office is reinstalled !!)

Strangely, the item remains on the menu (even after uninstalling the
add-in!!) but it is not loaded and therefore can't be invoked.

The menu item must be removed manually using word's "customize" option.
After that the add-in can be reinstalled and then works ok.

There's a clue in this KB article http://support.microsoft.com/?kbid=208316.
Although that's for outlook it lets on that any untrapped errros in a COM
add-in can have very serious consequences

Andy

"Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
news:uiyG4iDVGHA.5172@TK2MSFTNGP12.phx.gbl...
> well, I've tried reinstalling office and uninstalling norton on the
> affected PC but to no avail - exactly the same error.
>
> have also tried it on several more PCs which all work fine (this is why
> I'm convinced the code is Ok), so I'm no nearer the solution :-(
>
>
> "Jezebel" <warcrimes@whitehouse.gov> wrote in message
> news:uFF1xB7UGHA.6084@TK2MSFTNGP14.phx.gbl...
>> One thought: having changed the security setting, you need to restart
>> Word.
>>
>> This line is disconcerting: "I can't beleive I have done anything
>> wrong..." Spelling aside (oh the irony!), for a programmer, this
>> assertion is just folly.
>>
>>
>> "Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
>> news:%23Y78f$yUGHA.6112@TK2MSFTNGP10.phx.gbl...
>>> Hi,
>>>
>>> I have written a MS word COM add-in using vb6, which creates a menu item
>>> and invokes the add-in when it is clicked.
>>>
>>> It works on several of our PCs but on one users machine it always gives
>>> the following error when he tries to select the menu item:
>>>
>>> "The macro cannot be found or has been disabled because of your macro
>>> security settings"
>>>
>>> we have tried setting his macro security to low and still to no avail
>>> (mine is set to high and the plugin still works fine). he is using NAV
>>> but has disabled the office integration (and has also tried disabling
>>> the whole of NAV) but again he just gets the same error. All the PCs are
>>> using office 2003.
>>>
>>> I am using an add-in designer and have set the OnAction property of the
>>> CommandBarButton to "<!xxx>" where xxx is the progid of the designer. I
>>> can't beleive I have done anything wrong with the code because as I say
>>> it works on several other PCs. we can invoke the same progid via
>>> vbscript so I know everything is registered correctly
>>>
>>> does anyone have any clues for the next thing to try?
>>>
>>> Andy
>>>
>>>
>>
>>
>
>



Re: macro security error trying to invoke a plug-in by Cindy

Cindy
Sun Apr 09 12:32:43 CDT 2006

Hi Andy,

> The first time the add-in generates an untrapped exception, it will never be
> invoked again (even if word is restarted, the machine rebooted or, as in
> this case, office is reinstalled !!)
>
> Strangely, the item remains on the menu (even after uninstalling the
> add-in!!) but it is not loaded and therefore can't be invoked.
>
Since the "temporary" setting has no meaning for a commandbar control in the
Word environment, it's not surprising that the item would remain. The Addin was
disconnected, so any code you may have in the Addin to remove the control won't
fire.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)


Re: macro security error trying to invoke a plug-in by Andy

Andy
Wed Apr 12 08:21:07 CDT 2006


"Cindy M -WordMVP-" <C.Meister-C@hispeed.ch> wrote in message
news:VA.0000bc37.00d8f755@speedy...
> Hi Andy,
>
>> The first time the add-in generates an untrapped exception, it will never
>> be
>> invoked again (even if word is restarted, the machine rebooted or, as in
>> this case, office is reinstalled !!)
>>
>> Strangely, the item remains on the menu (even after uninstalling the
>> add-in!!) but it is not loaded and therefore can't be invoked.
>>
> Since the "temporary" setting has no meaning for a commandbar control in
> the
> Word environment, it's not surprising that the item would remain. The
> Addin was
> disconnected, so any code you may have in the Addin to remove the control
> won't
> fire.
>

Thanks for clarifying that. All the sample code I have seen adds the control
every time word starts up, so I had assumed that they were specific to that
"session" of word

Andy

> Cindy Meister
> INTER-Solutions, Switzerland
> http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
> http://www.word.mvps.org
>
> This reply is posted in the Newsgroup; please post any follow question or
> reply
> in the newsgroup and not by e-mail :-)
>



Re: macro security error trying to invoke a plug-in by praveen

praveen
Tue Apr 18 03:28:01 CDT 2006

Hi Andy,

I am also getting the same problem i.e "The macro caanot be found or has
been disabled because of your macro settings".

I have developed a shared add-in in vb.net for MS Word 2003 which i am
adding a new commandbar button in "Tools" commandbars and i have written a
commandbar control event which displays a message box.

everything is working fine but after displaying a message box i am getting a
dialog box saying that "The macro caanot be found or has been disabled
because of your macro settings". Currently my macro settings are medium and i
tried even with low and i did check in "Trust all installed addins and
templates".

I did develop the same addin in couple of boxes but i am getting this dialog
box("The macro caanot be found or has been disabled because of your macro
settings") in both of the boxes.


here is the add-in code


code:
--------------------------


Public Class Connect

Implements Extensibility.IDTExtensibility2
Dim applicationObject As Object
Dim addInInstance As Object
Dim objCommandBars As Microsoft.Office.Core.CommandBars
Dim objCommandBar As Microsoft.Office.Core.CommandBar
Dim objCommandBarControl As Microsoft.Office.Core.CommandBarControl
Dim WithEvents objCommandBarButton As
Microsoft.Office.Core.CommandBarButton

Public Sub OnStartupComplete(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnStartupComplete
Try
AddDocManagerMenuItem()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub



Public Sub OnBeginShutdown(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnBeginShutdown
Try
applicationObject.CommandBars.Item("Tools").Controls.Item("MY
Document Manager").Delete()
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub



Private Sub AddDocManagerMenuItem()

Try
objCommandBars = applicationObject.CommandBars
objCommandBar = objCommandBars.Item("Tools")

For Each objCommandBarControl In objCommandBar.Controls
If Trim(objCommandBarControl.Caption) = "MY Document
Manager" Then
objCommandBar.Controls.Item("MY Document
Manager").Delete()
End If
Next objCommandBarControl

objCommandBarButton = objCommandBar.Controls.Add(msoControlButton)
With objCommandBarButton

.Caption = "MY Document Manager"
.Tag = "MY Document Manager tag"
.OnAction = "MY Document Manager action"
.Visible = True
.TooltipText = "MY Document Manager tool tip"
End With

Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub


Private Sub objCommandBarButton_Click(ByVal Ctrl As
Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean)
Handles objCommandBarButton.Click
Try
MsgBox("Menu item clicked")
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub

End Class




Is there any problem in code or is it to do the word settings?

Any ideas please?


cheers

Praveen


"Andy Fish" wrote:

>
> "Cindy M -WordMVP-" <C.Meister-C@hispeed.ch> wrote in message
> news:VA.0000bc37.00d8f755@speedy...
> > Hi Andy,
> >
> >> The first time the add-in generates an untrapped exception, it will never
> >> be
> >> invoked again (even if word is restarted, the machine rebooted or, as in
> >> this case, office is reinstalled !!)
> >>
> >> Strangely, the item remains on the menu (even after uninstalling the
> >> add-in!!) but it is not loaded and therefore can't be invoked.
> >>
> > Since the "temporary" setting has no meaning for a commandbar control in
> > the
> > Word environment, it's not surprising that the item would remain. The
> > Addin was
> > disconnected, so any code you may have in the Addin to remove the control
> > won't
> > fire.
> >
>
> Thanks for clarifying that. All the sample code I have seen adds the control
> every time word starts up, so I had assumed that they were specific to that
> "session" of word
>
> Andy
>
> > Cindy Meister
> > INTER-Solutions, Switzerland
> > http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
> > http://www.word.mvps.org
> >
> > This reply is posted in the Newsgroup; please post any follow question or
> > reply
> > in the newsgroup and not by e-mail :-)
> >
>
>
>