![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi All,
I have a working Outlook 2003 COM add-in written in VB 6.0 based on Ken's ItemsCB template with Inspector wrapper class. It adds custom toolbar with few buttons and dropdown on the Inspector window. It works in Outlook 2007, but it is located under 'Add-ins' tab. What should I change so it will show up on the 'Message' tab instead, and use existing code in button_click event. Also what would be the easiest way to convert this to VSTO add-in for Outlook 2007 so I don't have to change much. Thanks, Goran |
Ads |
#2
|
|||
|
|||
![]()
What you have to do is check for versioning of the running Outlook and if
the major value is "12" you know it's Outlook 2007. Then you fork your code to handle the ribbon in that case instead of creating the CommandBars UI you would use for Outlook 2003 and earlier ("11" or less). The easiest way to do that in VB6 code is to download Dennis Wallentin's (XL-Dennis) XLIRibbonExtensibility tlb from his Web site and reference that everywhere you want to use Ribbon extensibility. That lets you handle the callbacks from the ribbon and to supply your custom XML for your Ribbon UI. An alternative is to put the Office 2007 MSO file on your dev system and reference that for the ribbon stuff, the CLSID's are compatible so your code will still run under earlier versions of Office. There's no conversion from VB6 to .NET code, except manually. You can start a VSTO Outlook 2007 project and cut and paste your VB6 code in and then hand translate it into VB.NET code. You have to take into account changes such as changing all of your VB6 Long variables into VB.NET Int's and so on. That's what I did to get my own templates and library code into VB.NET from VB6, and I did the same translating the VB6 into C# for my C# templates. The problem with VSTO is that if you develop for Outlook 2007 that's the only version it will run on. If you develop for Outlook 2003 it will run on Outlook 2007 but with no ribbon support. Since the shim is pre-compiled for VSTO that means that Dennis's method doesn't work well with VSTO in deployment, although the code works. For multi-version support in managed code I use shared addins and a hack of the custom shims provided for the Outlook team's sample addins that I modified to support Outlook 2003 with shimmed ribbon support. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "goran" wrote in message ... Hi All, I have a working Outlook 2003 COM add-in written in VB 6.0 based on Ken's ItemsCB template with Inspector wrapper class. It adds custom toolbar with few buttons and dropdown on the Inspector window. It works in Outlook 2007, but it is located under 'Add-ins' tab. What should I change so it will show up on the 'Message' tab instead, and use existing code in button_click event. Also what would be the easiest way to convert this to VSTO add-in for Outlook 2007 so I don't have to change much. Thanks, Goran |
#3
|
|||
|
|||
![]()
Thanks Ken for your prompt reply. I used Dennis's tlb to fork the code and
create CommandBar if it is version 11 or use GetCustomUI method in connect module in the case of office 12. I have my xml file for the ribbon. When I run it it shows up nicely, but how can I hook the onAction to run the code that I already have for Button_click. When specifying onAction callback it tries to find it in connect designer module, and my buttons and associated events are declared my Inspector wrapper class. Thanks, Goran "Ken Slovak - [MVP - Outlook]" wrote: What you have to do is check for versioning of the running Outlook and if the major value is "12" you know it's Outlook 2007. Then you fork your code to handle the ribbon in that case instead of creating the CommandBars UI you would use for Outlook 2003 and earlier ("11" or less). The easiest way to do that in VB6 code is to download Dennis Wallentin's (XL-Dennis) XLIRibbonExtensibility tlb from his Web site and reference that everywhere you want to use Ribbon extensibility. That lets you handle the callbacks from the ribbon and to supply your custom XML for your Ribbon UI. An alternative is to put the Office 2007 MSO file on your dev system and reference that for the ribbon stuff, the CLSID's are compatible so your code will still run under earlier versions of Office. There's no conversion from VB6 to .NET code, except manually. You can start a VSTO Outlook 2007 project and cut and paste your VB6 code in and then hand translate it into VB.NET code. You have to take into account changes such as changing all of your VB6 Long variables into VB.NET Int's and so on. That's what I did to get my own templates and library code into VB.NET from VB6, and I did the same translating the VB6 into C# for my C# templates. The problem with VSTO is that if you develop for Outlook 2007 that's the only version it will run on. If you develop for Outlook 2003 it will run on Outlook 2007 but with no ribbon support. Since the shim is pre-compiled for VSTO that means that Dennis's method doesn't work well with VSTO in deployment, although the code works. For multi-version support in managed code I use shared addins and a hack of the custom shims provided for the Outlook team's sample addins that I modified to support Outlook 2003 with shimmed ribbon support. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "goran" wrote in message ... Hi All, I have a working Outlook 2003 COM add-in written in VB 6.0 based on Ken's ItemsCB template with Inspector wrapper class. It adds custom toolbar with few buttons and dropdown on the Inspector window. It works in Outlook 2007, but it is located under 'Add-ins' tab. What should I change so it will show up on the 'Message' tab instead, and use existing code in button_click event. Also what would be the easiest way to convert this to VSTO add-in for Outlook 2007 so I don't have to change much. Thanks, Goran |
#4
|
|||
|
|||
![]()
That's where the sneaky part comes in
![]() In cases like that I put a public property in my Inspector wrapper class called Ribbon that is set to the Ribbon object in my Connect class (or you can make the Ribbon object in Connect global). I also put in the wrapper class a public Sub that I usually call RibbonClicker(). I also have a public Inspector property in the wrapper class that returns the Inspector for that class. In Outlook 2007 you can directly compare control.Context from the ribbon callback to the Inspector property in each existing wrapper class instance using equality: If (control.Context = wrapper(i).Inspector) Then So I always can get the correct Inspector wrapper class. I then call into the wrapper class's RibbonClicker() procedure, passing along the ribbon control.ID as an argument to RibbonClicker(). In RibbonClicker() I compare the id (ribbon control tag) to the tags for all the available ribbon controls and from that I know which control was clicked and which button event handler it corresponds to. I then set up a dummy null CommandBarButton and a dummy boolean Cancel variable and pass those to the appropriate button click event handler, which then executes the code for that event handler. In cases where I need to pass other information to the eventual procedure to handle the clicks I have both the button event handler and the ribbon clicker procedure call the same child procedure to execute the click code. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "goran" wrote in message ... Thanks Ken for your prompt reply. I used Dennis's tlb to fork the code and create CommandBar if it is version 11 or use GetCustomUI method in connect module in the case of office 12. I have my xml file for the ribbon. When I run it it shows up nicely, but how can I hook the onAction to run the code that I already have for Button_click. When specifying onAction callback it tries to find it in connect designer module, and my buttons and associated events are declared my Inspector wrapper class. Thanks, Goran |
#5
|
|||
|
|||
![]()
Thanks a lot as always Ken.
This thing worked, and I am able to route callbacks to my specific Wrapper code. But now I am confused. I used to have dropdown control in inspector wrapper that I declared as: Private WithEvents CBInspectorDropdown As Office.CommandBarComboBox, and then I pull the items from DB and populated this dropdown when Inspector opened. I also had _Change event for the dropdown where I would put the code to do something based on user selection. Now, I defined dropdown in xml. How can i reference that dropdown in my code in vb 6 and load with items in the runtime, get selected item etc. thanks, Goran "Ken Slovak - [MVP - Outlook]" wrote: That's where the sneaky part comes in ![]() In cases like that I put a public property in my Inspector wrapper class called Ribbon that is set to the Ribbon object in my Connect class (or you can make the Ribbon object in Connect global). I also put in the wrapper class a public Sub that I usually call RibbonClicker(). I also have a public Inspector property in the wrapper class that returns the Inspector for that class. In Outlook 2007 you can directly compare control.Context from the ribbon callback to the Inspector property in each existing wrapper class instance using equality: If (control.Context = wrapper(i).Inspector) Then So I always can get the correct Inspector wrapper class. I then call into the wrapper class's RibbonClicker() procedure, passing along the ribbon control.ID as an argument to RibbonClicker(). In RibbonClicker() I compare the id (ribbon control tag) to the tags for all the available ribbon controls and from that I know which control was clicked and which button event handler it corresponds to. I then set up a dummy null CommandBarButton and a dummy boolean Cancel variable and pass those to the appropriate button click event handler, which then executes the code for that event handler. In cases where I need to pass other information to the eventual procedure to handle the clicks I have both the button event handler and the ribbon clicker procedure call the same child procedure to execute the click code. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "goran" wrote in message ... Thanks Ken for your prompt reply. I used Dennis's tlb to fork the code and create CommandBar if it is version 11 or use GetCustomUI method in connect module in the case of office 12. I have my xml file for the ribbon. When I run it it shows up nicely, but how can I hook the onAction to run the code that I already have for Button_click. When specifying onAction callback it tries to find it in connect designer module, and my buttons and associated events are declared my Inspector wrapper class. Thanks, Goran |
#6
|
|||
|
|||
![]()
The ribbon combo is populated by XML when the control is initialized,
therefore it's not so great for dynamically populated lists. About the only way I've found to do that is to actually create the ribbon XML on the fly when GetCustomUI fires. For dynamically populated controls I usually prefer to use the dynamicMenu control, which has a getContent callback that's used to provide the XML for the control. You still have to create that XML on the fly but you don't have to create the entire ribbon XML on the fly. Of course the dynamicMenu control doesn't have that textbox associated with it. For combo's you get an onChange callback. You might find the articles starting at http://msdn2.microsoft.com/en-us/library/aa338202.aspx to be of interest. The code samples are in C# and VB.NET, but they're simple and readable. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "goran" wrote in message ... Thanks a lot as always Ken. This thing worked, and I am able to route callbacks to my specific Wrapper code. But now I am confused. I used to have dropdown control in inspector wrapper that I declared as: Private WithEvents CBInspectorDropdown As Office.CommandBarComboBox, and then I pull the items from DB and populated this dropdown when Inspector opened. I also had _Change event for the dropdown where I would put the code to do something based on user selection. Now, I defined dropdown in xml. How can i reference that dropdown in my code in vb 6 and load with items in the runtime, get selected item etc. thanks, Goran |
#7
|
|||
|
|||
![]()
Thanks Ken. And where should I check this if
(control.context=wrapper(i).inspector? In the connection module or in inspector wrapper class? "Ken Slovak - [MVP - Outlook]" wrote: The ribbon combo is populated by XML when the control is initialized, therefore it's not so great for dynamically populated lists. About the only way I've found to do that is to actually create the ribbon XML on the fly when GetCustomUI fires. For dynamically populated controls I usually prefer to use the dynamicMenu control, which has a getContent callback that's used to provide the XML for the control. You still have to create that XML on the fly but you don't have to create the entire ribbon XML on the fly. Of course the dynamicMenu control doesn't have that textbox associated with it. For combo's you get an onChange callback. You might find the articles starting at http://msdn2.microsoft.com/en-us/library/aa338202.aspx to be of interest. The code samples are in C# and VB.NET, but they're simple and readable. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "goran" wrote in message ... Thanks a lot as always Ken. This thing worked, and I am able to route callbacks to my specific Wrapper code. But now I am confused. I used to have dropdown control in inspector wrapper that I declared as: Private WithEvents CBInspectorDropdown As Office.CommandBarComboBox, and then I pull the items from DB and populated this dropdown when Inspector opened. I also had _Change event for the dropdown where I would put the code to do something based on user selection. Now, I defined dropdown in xml. How can i reference that dropdown in my code in vb 6 and load with items in the runtime, get selected item etc. thanks, Goran |
#8
|
|||
|
|||
![]()
I can create xml dynamically. But how can I reference combobox in the code
once it is populated? For example, when I click on the button next to combobox I want to get the currently selected index and selected text. Do I refer to it by id that I specified in the xml? Thanks, Goran "Ken Slovak - [MVP - Outlook]" wrote: The ribbon combo is populated by XML when the control is initialized, therefore it's not so great for dynamically populated lists. About the only way I've found to do that is to actually create the ribbon XML on the fly when GetCustomUI fires. For dynamically populated controls I usually prefer to use the dynamicMenu control, which has a getContent callback that's used to provide the XML for the control. You still have to create that XML on the fly but you don't have to create the entire ribbon XML on the fly. Of course the dynamicMenu control doesn't have that textbox associated with it. For combo's you get an onChange callback. You might find the articles starting at http://msdn2.microsoft.com/en-us/library/aa338202.aspx to be of interest. The code samples are in C# and VB.NET, but they're simple and readable. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "goran" wrote in message ... Thanks a lot as always Ken. This thing worked, and I am able to route callbacks to my specific Wrapper code. But now I am confused. I used to have dropdown control in inspector wrapper that I declared as: Private WithEvents CBInspectorDropdown As Office.CommandBarComboBox, and then I pull the items from DB and populated this dropdown when Inspector opened. I also had _Change event for the dropdown where I would put the code to do something based on user selection. Now, I defined dropdown in xml. How can i reference that dropdown in my code in vb 6 and load with items in the runtime, get selected item etc. thanks, Goran |
#9
|
|||
|
|||
![]()
You check that in the ribbon callback, such as in onAction.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "goran" wrote in message ... Thanks Ken. And where should I check this if (control.context=wrapper(i).inspector? In the connection module or in inspector wrapper class? |
#10
|
|||
|
|||
![]()
Unfortunately that's not exposed.
Dennis's tlb doesn't expose some ribbon-related methods in the Office 12 library such as ExecuteMso(idMSO) or GetEnabledMso(idMSO), but there isn't a method for reading either of those combo properties. You have to track the state of any property you want to evaluate yourself. When the combo's onChange() callback fires you would update your property variables. The second of those articles I referenced has a complete list of all combo callbacks. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "goran" wrote in message ... I can create xml dynamically. But how can I reference combobox in the code once it is populated? For example, when I click on the button next to combobox I want to get the currently selected index and selected text. Do I refer to it by id that I specified in the xml? Thanks, Goran |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Setting Up an Outlook 2007 with an Exchange Server 2007 E-mailAddress | Scott Christopher | Outlook - Installation | 0 | March 3rd 08 10:08 PM |
Any planned improvements for Word HTML rendering engine in Office 2007 SP2? ...for Outlook 2007 | anthonyx26 | Outlook - General Queries | 2 | January 18th 08 12:44 AM |
Outlook 2007 shared calendars are lost when exchange 2007 reboot | Cris Krikkke | Outlook - Calandaring | 2 | December 14th 07 07:25 AM |
Office Standard 2007 Trial & Outlook 2007 full version | cmmsc777 | Outlook - Installation | 3 | November 7th 07 09:10 PM |
Outlook 2007 will not open SharePoint 2007 task assignment messages | ACK | Outlook - General Queries | 3 | February 16th 07 02:15 AM |