getSelectedItem does not work in unmanaged Com-Add In

Status
Not open for further replies.
P

Peter Marchert

Hello,

I try to set the default value for a dropdown control in a ribbon.

This is the xml part of the dropdown:

<dropDown id="dropDownControl"

getSelectedItemIndex="CallBackSelectedItemIndex"

onAction="CallBackOnAction"

visible="true"
<item id="dropDownItem0" label="Test1" /
<item id="dropDownItem1" label="Test2" /
<item id="dropDownItem2" label="Test3" /
</dropDown
The callback procedure "onAction" does always work but the

getSelectedItemIndex (same for getSelectedItemID) does not work

correctly.

Here are some examples of the definition for the callback procedure

which works (the message box appears):

Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl)

MsgBox Ctrl.id

End Sub

Public Sub CallBackSelectedItemIndex(ByVal Ctrl As IRibbonControl)

MsgBox Ctrl.id

End Sub

Public Sub CallBackSelectedItemIndex(ByRef Ctrl As IRibbonControl)

MsgBox Ctrl.id

End Sub

But if a second parameter is used the message box will not appear. I

tried this combinations:

Public Sub CallBackSelectedItemIndex(ByVal Ctrl As IRibbonControl,

ByRef Index)

Public Sub CallBackSelectedItemIndex(ByRef Ctrl As IRibbonControl,

ByRef Index)

Public Sub CallBackSelectedItemIndex(ByRef Ctrl As IRibbonControl,

ByRef Index As Integer)

Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, Index)

Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, Index As

Integer)

Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, Index As

Long)

Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, ByRef

Index As Integer)

Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, ByRef

Index As Long)

Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, ByRef

Index As Byte)

Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, ByRef

Index As Single)

Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, ByRef

Index As Double)

Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, ByRef

Index As String)

Public Sub CallBackSelectedItemIndex(ByVal Ctrl As IRibbonControl,

ByRef Index As Variant)

I'm using the Office Developer XP to create Com-Add-Ins and designed

it under Microsoft Outlook 2002. To use the ribbons I have implemented

this type library: http://xldennis.wordpress.com/2006/...dalone-type-library-for-iribbonextensibility/

Is it possible that this library is not correct/complete (it is from

2006)?

I worked on this problem now for 2 days and wonder that other users

does not have this problem. Can somebody who uses VB6 try this example

and report if it works with it?

Thanks

Peter
 
Dennis's tlb has nothing to do with callback signatures for various ribbon

control callbacks. It has the interface definitions of the ribbon

(IRibbonControl, IRibbonExtensibility and IRibbonUI), that's it. The ribbon

callbacks are controlled and validated by the ribbon schema.

The signature for that callback for VB6/VBA would be:

Sub CallBackSelectedItemIndex(ByVal control As IRibbonControl, ByRef

index As Integer)

"Peter Marchert" <_google@arcor.de> wrote in message

news:230ac3a9-c23d-46fe-98c4-4abeb2c9c181@t13g2000yqt.googlegroups.com...
> Hello,

> I try to set the default value for a dropdown control in a ribbon.
> This is the xml part of the dropdown:

> <dropDown id="dropDownControl"
> getSelectedItemIndex="CallBackSelectedItemIndex"
> onAction="CallBackOnAction"
> visible="true"
> <item id="dropDownItem0" label="Test1" /
> <item id="dropDownItem1" label="Test2" /
> <item id="dropDownItem2" label="Test3" /
> </dropDown
> The callback procedure "onAction" does always work but the
> getSelectedItemIndex (same for getSelectedItemID) does not work
> correctly.

> Here are some examples of the definition for the callback procedure
> which works (the message box appears):

> Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl)
> MsgBox Ctrl.id
> End Sub

> Public Sub CallBackSelectedItemIndex(ByVal Ctrl As IRibbonControl)
> MsgBox Ctrl.id
> End Sub

> Public Sub CallBackSelectedItemIndex(ByRef Ctrl As IRibbonControl)
> MsgBox Ctrl.id
> End Sub

> But if a second parameter is used the message box will not appear. I
> tried this combinations:

> Public Sub CallBackSelectedItemIndex(ByVal Ctrl As IRibbonControl,
> ByRef Index)
> Public Sub CallBackSelectedItemIndex(ByRef Ctrl As IRibbonControl,
> ByRef Index)
> Public Sub CallBackSelectedItemIndex(ByRef Ctrl As IRibbonControl,
> ByRef Index As Integer)
> Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, Index)
> Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, Index As
> Integer)
> Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, Index As
> Long)
> Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, ByRef
> Index As Integer)
> Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, ByRef
> Index As Long)
> Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, ByRef
> Index As Byte)
> Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, ByRef
> Index As Single)
> Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, ByRef
> Index As Double)
> Public Sub CallBackSelectedItemIndex(Ctrl As IRibbonControl, ByRef
> Index As String)
> Public Sub CallBackSelectedItemIndex(ByVal Ctrl As IRibbonControl,
> ByRef Index As Variant)

> I'm using the Office Developer XP to create Com-Add-Ins and designed
> it under Microsoft Outlook 2002. To use the ribbons I have implemented
> this type library:
> http://xldennis.wordpress.com/2006/...dalone-type-library-for-iribbonextensibility/

> Is it possible that this library is not correct/complete (it is from
> 2006)?

> I worked on this problem now for 2 days and wonder that other users
> does not have this problem. Can somebody who uses VB6 try this example
> and report if it works with it?

> Thanks
> Peter
 
On 12 Aug., 22:04, " - " <kenslo...@mvps.org
wrote:


> Dennis's tlb has nothing to do with callback signatures for various ribbon
> control callbacks. It has the interface definitions of the ribbon
> (IRibbonControl, IRibbonExtensibility and IRibbonUI), that's it.


Thanks Ken, that saves me the time to create a new one and try it with

this.


> The ribbon callbacks are controlled and validated by the ribbon schema.


I use this one: http://schemas.microsoft.com/office/2006/01/customui

and this works fine e. g. in a normal Excel file.


> The signature for that callback for VB6/VBA would be:

>     Sub CallBackSelectedItemIndex(ByVal control As IRibbonControl, ByRef
> index As Integer)


Thank you but also with exactly this definition it will not work.

Seems it has something to do with my develop environment that I cannot

fix. May be this can some one confirm who created an unmanaged Com-Add

In too but the geSelectedItemIndex callback will work fine.

Thanks

Peter
 
That's the correct schema to use for Office 2007.

I haven't personally used any ribbon drop-down controls in any of my addins,

managed or unmanaged. I usually don't like the way they work, instead I've

used dynamicMenu controls for what I've had to do.

I'll see if I get a chance today or tomorrow to hack your ribbon code into a

test addin in VB6 I use to play with things and see what happens. I'll let

you know.

"Peter Marchert" <_google@arcor.de> wrote in message

news:bdc92058-95a7-45df-82bd-948baf58a27b@g10g2000yqh.googlegroups.com...

On 12 Aug., 22:04, " - " <kenslo...@mvps.org
wrote:


> Dennis's tlb has nothing to do with callback signatures for various ribbon
> control callbacks. It has the interface definitions of the ribbon
> (IRibbonControl, IRibbonExtensibility and IRibbonUI), that's it.


Thanks Ken, that saves me the time to create a new one and try it with

this.


> The ribbon callbacks are controlled and validated by the ribbon schema.


I use this one: http://schemas.microsoft.com/office/2006/01/customui

and this works fine e. g. in a normal Excel file.


> The signature for that callback for VB6/VBA would be:

> Sub CallBackSelectedItemIndex(ByVal control As IRibbonControl, ByRef
> index As Integer)


Thank you but also with exactly this definition it will not work.

Seems it has something to do with my develop environment that I cannot

fix. May be this can some one confirm who created an unmanaged Com-Add

In too but the geSelectedItemIndex callback will work fine.

Thanks

Peter
 
On 13 Aug., 15:20, " - " <kenslo...@mvps.org
wrote:
> That's the correct schema to use for Office 2007.

> I haven't personally used any ribbon drop-down controls in any of my addins,
> managed or unmanaged. I usually don't like the way they work, instead I've
> used dynamicMenu controls for what I've had to do.


May be this will do my job too. I will have a look at it, thank you.


> I'll see if I get a chance today or tomorrow to hack your ribbon code into a
> test addin in VB6 I use to play with things and see what happens. I'll let
> you know.


That would be very kind of you.

Thank you

Peter


> >

> http://www.slovaktech.com

> "Peter Marchert" <_goo...@arcor.de> wrote in message

> news:bdc92058-95a7-45df-82bd-948baf58a27b@g10g2000yqh.googlegroups.com...
> On 12 Aug., 22:04, " - " <kenslo...@mvps.org
> wrote:
>
> > Dennis's tlb has nothing to do with callback signatures for various ribbon
> > control callbacks. It has the interface definitions of the ribbon
> > (IRibbonControl, IRibbonExtensibility and IRibbonUI), that's it.


> Thanks Ken, that saves me the time to create a new one and try it with
> this.
>
> > The ribbon callbacks are controlled and validated by the ribbon schema.


> I use this one:http://schemas.microsoft.com/office/2006/01/customui
> and this works fine e. g. in a normal Excel file.
>
> > The signature for that callback for VB6/VBA would be:

>
> > Sub CallBackSelectedItemIndex(ByVal control As IRibbonControl, ByRef
> > index As Integer)


> Thank you but also with exactly this definition it will not work.

> Seems it has something to do with my develop environment that I cannot
> fix. May be this can some one confirm who created an unmanaged Com-Add
> In too but the geSelectedItemIndex callback will work fine.

> Thanks
> Peter
 
It looks like the signature that we both found for that callback is for VBA,

not for VB6. For VB6 it's a Function that returns an Integer, not a Sub.

Here is the signature for the callback in VB6, which I tested with my test

addin and which works:

Function GetSelectedItemIndex(control As IRibbonControl) As Integer

See http://msdn.microsoft.com/en-us/library/aa722523.aspx for a complete

list of callback signatures for various languages, including VB6. Make sure

you use those signatures and not the ones for VBA.
<kenslovak@mvps.org> wrote in message

news:%23uHZYjBHKHA.4168@TK2MSFTNGP05.phx.gbl...
> That's the correct schema to use for Office 2007.

> I haven't personally used any ribbon drop-down controls in any of my
> addins, managed or unmanaged. I usually don't like the way they work,
> instead I've used dynamicMenu controls for what I've had to do.

> I'll see if I get a chance today or tomorrow to hack your ribbon code into
> a test addin in VB6 I use to play with things and see what happens. I'll
> let you know.

> >

>

> "Peter Marchert" <_google@arcor.de> wrote in message
> news:bdc92058-95a7-45df-82bd-948baf58a27b@g10g2000yqh.googlegroups.com...
> On 12 Aug., 22:04, " - " <kenslo...@mvps.org
> wrote:
>
> > Dennis's tlb has nothing to do with callback signatures for various
> > ribbon
> > control callbacks. It has the interface definitions of the ribbon
> > (IRibbonControl, IRibbonExtensibility and IRibbonUI), that's it.


> Thanks Ken, that saves me the time to create a new one and try it with
> this.
>
> > The ribbon callbacks are controlled and validated by the ribbon schema.


> I use this one: http://schemas.microsoft.com/office/2006/01/customui
> and this works fine e. g. in a normal Excel file.
>
> > The signature for that callback for VB6/VBA would be:
>

>> Sub CallBackSelectedItemIndex(ByVal control As IRibbonControl, ByRef
> > index As Integer)


> Thank you but also with exactly this definition it will not work.

> Seems it has something to do with my develop environment that I cannot
> fix. May be this can some one confirm who created an unmanaged Com-Add
> In too but the geSelectedItemIndex callback will work fine.

> Thanks
> Peter
 
On 13 Aug., 16:21, " - " <kenslo...@mvps.org
wrote:
> It looks like the signature that we both found for that callback is for VBA,
> not for VB6. For VB6 it's a Function that returns an Integer, not a Sub.


That's it! Thank you very, very much for your help!

Peter


> Here is the signature for the callback in VB6, which I tested with my test
> addin and which works:

>     Function GetSelectedItemIndex(control As IRibbonControl) As Integer

> Seehttp://msdn.microsoft.com/en-us/library/aa722523.aspxfor a complete
> list of callback signatures for various languages, including VB6. Make sure
> you use those signatures and not the ones for VBA.

> >

> http://www.slovaktech.com

> " - " <kenslo...@mvps.org> wrote in messagenews:%23uHZYjBHKHA.4168@TK2MSFTNGP05.phx.gbl...

>
> > That's the correct schema to use for Office 2007.

>
> > I haven't personally used any ribbon drop-down controls in any of my
> > addins, managed or unmanaged. I usually don't like the way they work,
> > instead I've used dynamicMenu controls for what I've had to do.

>
> > I'll see if I get a chance today or tomorrow to hack your ribbon code into
> > a test addin in VB6 I use to play with things and see what happens. I'll
> > let you know.

>
> > > >

> >

> >

>
> > "Peter Marchert" <_goo...@arcor.de> wrote in message
> >news:bdc92058-95a7-45df-82bd-948baf58a27b@g10g2000yqh.googlegroups.com....
> > On 12 Aug., 22:04, " - " <kenslo...@mvps.org
> > wrote:

>
> >> Dennis's tlb has nothing to do with callback signatures for various
> >> ribbon
> >> control callbacks. It has the interface definitions of the ribbon
> >> (IRibbonControl, IRibbonExtensibility and IRibbonUI), that's it.

>
> > Thanks Ken, that saves me the time to create a new one and try it with
> > this.

>
> >> The ribbon callbacks are controlled and validated by the ribbon schema..

>
> > I use this one:http://schemas.microsoft.com/office/2006/01/customui
> > and this works fine e. g. in a normal Excel file.

>
> >> The signature for that callback for VB6/VBA would be:

>
> >> Sub CallBackSelectedItemIndex(ByVal control As IRibbonControl, ByRef
> >> index As Integer)

>
> > Thank you but also with exactly this definition it will not work.

>
> > Seems it has something to do with my develop environment that I cannot
> > fix. May be this can some one confirm who created an unmanaged Com-Add
> > In too but the geSelectedItemIndex callback will work fine.

>
> > Thanks
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
D Send on behalf of does not store the base mailbox Using Outlook 0
e_a_g_l_e_p_i Why does MS do these things???? Using Outlook 4
M "Attachment Detacher for Outlook" add in, does it update the server copy of the email? Using Outlook 1
Witzker Outlook 2019 Edit contact from email does not open the user defined contactform Using Outlook 3
J Event/Meeting in Outlook Does Not Align with SharePoint Calendar Using Outlook 5
C Code to move mail with certain attachment name? Does Not work Outlook VBA and Custom Forms 3
J Does the .fdm contain my custom form? How to make ol use it? - ol2007 Outlook VBA and Custom Forms 4
C Why does Outlook (desktop) 365 for Windows keep making me input my passwords? Using Outlook 12
G Script does not exist Outlook VBA and Custom Forms 0
J WshShell.Popup does't timeout Outlook VBA and Custom Forms 3
N Save selected messages VBA does not save replies and/or messages that contain : in subject Outlook VBA and Custom Forms 1
T Junk Email does not get added to the Blocked Sender List Using Outlook 0
L Does this really work and get thru virus and malware blocks? Using Outlook 3
V Outlook 2016 Does Outlook-2016 (64 bit) work with iCloud for Windows ? Using Outlook 5
F Junk Email does not get added to the Blocked Sender List Using Outlook 4
N Free/busy publish at http location does not work Using Outlook 1
T Why does outlook 2010 convert only some forum notifications to plain text? Using Outlook 0
R Auto display of new email does not work on non-default account Outlook VBA and Custom Forms 0
M Deleting attachments does not reduce file size Using Outlook 0
M vCard does not have user-defined fields from my custom contact form (365) Using Outlook 1
M Outlook .com group does not show up in Outlook for office 365 home Using Outlook 3
W Outlook Calendar does not save view any longer! Using Outlook 3
B Outlook 2016 Does not Shutdown Correctly Using Outlook 3
P Desktop doesn't index Outlook IMAP files, laptop Outlook does index those same IMAP files Using Outlook 2
G Entered data in custom field goes in card and does not stay in list view Outlook VBA and Custom Forms 1
Witzker social connector 2010 does not show all emails to or from contact Using Outlook 3
Witzker social connector 2010 does not show all emails to or from contact Using Outlook 0
Rupert Dragwater Email flag does not show up in Outlook2013 Using Outlook 13
J Outlook 2016 message content does not display - outlook.com; exchange Using Outlook.com accounts in Outlook 9
D Outlook 2016 IMAP Connection Returns All Email but outlook.com does NOT Using Outlook.com accounts in Outlook 2
A BCM does not work anymore! BCM (Business Contact Manager) 1
D Outlook 2016: /altvba startup switch does not work Using Outlook 2
A BCM does not work with Windows 10 1703 any more BCM (Business Contact Manager) 3
S Outlook does not open the .pst file created by the Outlook Using Outlook 5
Q Undisclosed recipients does not include sender Using Outlook 1
N Does a Shared Folder Policy override a Digital Signature Setting for macros? Outlook VBA and Custom Forms 6
E What does mean this icon at the picture attached? Using Outlook 2
O Windows 10 x64 Outlook 2013 - URL does not open (anymore) Using Outlook 3
M How does Outlook determine item numbers in a folder? Outlook VBA and Custom Forms 3
LarryS change day template as cpao does not see .catx files Outlook VBA and Custom Forms 4
C Discovery search does not show autoforwarded messages Exchange Server Administration 1
C Unchecking "Send immediately when connected" does not work on apps that call Outlook Using Outlook 1
J Outlook 2010 VBScript editor does not run code at all Outlook VBA and Custom Forms 0
Mark Foley Time span on WebDAV published Calendars does not appear to be working Using Outlook 7
snhnic Macro that does not overwrite but add a number Outlook VBA and Custom Forms 1
Rupert Dragwater Deleting email from Deleted Items does not work Using Outlook 0
G Outlook does not show new appointments in To-Do-Bar Using Outlook 0
G Calendar does not point to deafult data file Using Outlook 0
Diane Poremsky What does the "J" mean? Using Outlook 0
Christiaan Could not complete operation because the service provider does not support it Using Outlook 2

Similar threads

Back
Top