Re: Using CancelDefault with a CommandBarButton by Perry
Perry
Tue Dec 13 18:35:50 CST 2005
It can be done, look at my other posting, it's there :-)
-------------------------------------
Krgrds,
Perry
"DataDay" <DataDay@discussions.microsoft.com> wrote in message
news:E9621DBF-084E-4A23-B2F2-3112F4EF3113@microsoft.com...
> Yes, I did try you method, but it does not give me the results I need.
>
> The email button on the standard toolbar and File|Send To|Mail Recipient
> (with attachment) function in two different ways. I do not wish to
> disable
> the button on the standard toolbar. I need to "highjack" the click event
> of
> File|Send To|Mail Recipient (with attachment) supress the action it
> normally
> takes and have it call my own function (not one that corisponds to an
> existing button).
>
> "Perry" wrote:
>
>> Disabling the button on the "standard" commandbar will also disable the
>> File
>> | Sent To email recipient ...
>> Have you tried it ??
>> -------------------------------------
>> Krgrds,
>> Perry
>>
>> "DataDay" <DataDay@discussions.microsoft.com> wrote in message
>> news:4A5E813F-5245-4F5A-AE36-1B9897C4CCD7@microsoft.com...
>> > Thanks Perry, but I'm working on the one in File|Send To.
>> >
>> >
>> > "Perry" wrote:
>> >
>> >> You can intercept the Email button on the "Standard" commandbar by
>> >> placing
>> >> your code in ThisDocument class module
>> >> You will have to redirect the button using some other code like in
>> >> below
>> >> example:
>> >> 'macro in a standard module
>> >> Sub ReDirectEmailBtn()
>> >> Set ThisDocument.btnEmail = CommandBars(1).Controls(5)
>> >> End Sub
>> >>
>> >> 'these lines in classmodule: ThisDocument
>> >> Public WithEvents btnEmail As Office.CommandBarButton
>> >> Private Sub btnEmail_Click(ByVal Ctrl As Office.CommandBarButton,
>> >> CancelDefault As Boolean)
>> >> CancelDefault = True
>> >> 'Go ahead and do other stuff
>> >> End Sub
>> >>
>> >> Krgrds,
>> >> Perry
>> >>
>> >> -------------------------------------
>> >> "DataDay" <DataDay@discussions.microsoft.com> wrote in message
>> >> news:6976FEA0-0662-4E6F-9CC6-EA8AB8EADCFC@microsoft.com...
>> >> > Hello,
>> >> >
>> >> > I'm using "Dim WithEvents btnEmail As CommandBarButton" to drop the
>> >> > click
>> >> > event of the Mail Recipient (with attachment) in Word. I can catch
>> >> > the
>> >> > event
>> >> > and fire other actions, but the default action will not cancel. Any
>> >> > suggestions?
>> >> >
>> >> > Thanks
>> >> >
>> >> > Private Sub btnEmail_Click(ByVal Ctrl As Office.CommandBarButton,
>> >> > CancelDefault As Boolean)
>> >> >
>> >> > CancelDefault = True
>> >> > 'Do something else instead
>> >> >
>> >> > End sub
>> >>
>> >>
>> >>
>>
>>
>>