Outlook 2007 Ribbons and VB6

S

Sanjay Singh

All the information on the web regarding Outlook 2007 development seems to
be using VB.Net 2005.

Are there any resources available for users wanting to using VB6.

I am interested in upgrading our addins to work with Outlook 2007.

Most of the code seems to work without any problems.

The only issue is adding controls to the Ribbon.

Is there any sample code that shows the best way to do this using VB6.
(Postings by the Outlook gurus indicate that VB6 is still the best tool for
addins development (we need to support Outlook 2000 onwards))

Thanks in advance.

Sanjay
 
P

Patrick Schmid [MVP]

The key question is: Do you need one add-in that supports 2000-2007, or
can you split it into two: one for 2000-2003 and one for 2007?

Have you looked at the RibbonX stuff and understand how do it with
VB.NET?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 Beta 2 Technical Refresh (B2TR):
http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007: http://pschmid.net/office2007/customize
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
 
S

Sanjay Singh

I haven't really ventured in .Net since our working is largely focussed on
having to support Office 2000 onwards.

Since Vb.Net did not easily support all the versions in the same addin, we
have stuck to using VB6.

We have started looking at .Net in the last few weeks purely from the point
of of view of trying to get Ribbons to work.

However (if possible), I would like to keep everything oin vb6.

I do realize however that I will need to have a different compiled version
for Outlook 2007.

Is there sample code that shows how to implement the ribbon in Vb6 (with
Inspector Classes)

Thanks
Sanjay

Patrick Schmid said:
The key question is: Do you need one add-in that supports 2000-2007, or
can you split it into two: one for 2000-2003 and one for 2007?

Have you looked at the RibbonX stuff and understand how do it with VB.NET?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 Beta 2 Technical Refresh (B2TR):
http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007: http://pschmid.net/office2007/customize
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

All the information on the web regarding Outlook 2007 development seems
to
be using VB.Net 2005.

Are there any resources available for users wanting to using VB6.

I am interested in upgrading our addins to work with Outlook 2007.

Most of the code seems to work without any problems.

The only issue is adding controls to the Ribbon.

Is there any sample code that shows the best way to do this using VB6.
(Postings by the Outlook gurus indicate that VB6 is still the best tool
for
addins development (we need to support Outlook 2000 onwards))

Thanks in advance.

Sanjay
 
P

Patrick Schmid [MVP]

Hi Sanjav,

I don't know if there is any VB6 code out there yet. I for sure know
that people (non-MS) are working on it.
I mainly asked about VB.NET to see if you have a general understanding
of how the ribbon customization works. Irrespective of the language you
use, you need to provide RibbonX code to the Office program and handle
callbacks. The only difference between VB6 and VB.Net is in the function
signatures and how you have to implement the Ribbon interface
(IRibbonExtensibility).I am myself a .NET guy, so I can't help with how
the thing has to look like in VB6.
I can help you with the RibbonX and that sort of stuff though. For the
VB6, just wait for a reply here till Monday. I am pretty sure someone is
going to see it and reply. If not, post back on Monday and I'll make
sure the person I have in mind sees it and replies ;)

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 Beta 2 Technical Refresh (B2TR):
http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007: http://pschmid.net/office2007/customize
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

I haven't really ventured in .Net since our working is largely focussed on
having to support Office 2000 onwards.

Since Vb.Net did not easily support all the versions in the same addin, we
have stuck to using VB6.

We have started looking at .Net in the last few weeks purely from the point
of of view of trying to get Ribbons to work.

However (if possible), I would like to keep everything oin vb6.

I do realize however that I will need to have a different compiled version
for Outlook 2007.

Is there sample code that shows how to implement the ribbon in Vb6 (with
Inspector Classes)

Thanks
Sanjay

Patrick Schmid said:
The key question is: Do you need one add-in that supports 2000-2007, or
can you split it into two: one for 2000-2003 and one for 2007?

Have you looked at the RibbonX stuff and understand how do it with VB.NET?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 Beta 2 Technical Refresh (B2TR):
http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007: http://pschmid.net/office2007/customize
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

All the information on the web regarding Outlook 2007 development seems
to
be using VB.Net 2005.

Are there any resources available for users wanting to using VB6.

I am interested in upgrading our addins to work with Outlook 2007.

Most of the code seems to work without any problems.

The only issue is adding controls to the Ribbon.

Is there any sample code that shows the best way to do this using VB6.
(Postings by the Outlook gurus indicate that VB6 is still the best tool
for
addins development (we need to support Outlook 2000 onwards))

Thanks in advance.

Sanjay
 
K

Ken Slovak - [MVP - Outlook]

There's no sample code out there now, but there soon will be.

Doing ribbon support is simple in VB6. Just put an Implements statement in
your Connect class for Office.IRibbonX and handle the 2 required interface
events. The implementation must be in the same class that implements
IDTExtensibility2. That precludes having one addin for all versions. You'll
need 2 versions.

Ribbon OnLoad fires in the Inspector.Activate event. So don't depend on an
initialized ribbon object until then, and don't depend on one in the first
NewInspector event. When that callback happens you can fill-in any ribbon
related objects you need in your Inspector wrapper class at that point.

Each first time a specific type of Inspector opens the XML for that ribbon
is loaded in the GetCustomUI handler. The types of Inspectors are:

'Microsoft.Outlook.Mail.Read

'Microsoft.Outlook.Mail.Compose

'Microsoft.Outlook.MeetingRequest.Read

'Microsoft.Outlook.MeetingRequest.Send

'Microsoft.Outlook.Appointment

'Microsoft.Outlook.Contact

'Microsoft.Outlook.Journal

'Microsoft.Outlook.Task

'Microsoft.Outlook.DistributionList

'Microsoft.Outlook.Report

'Microsoft.Outlook.Resend

'Microsoft.Outlook.Response.Read

'Microsoft.Outlook.Response.Compose

'Microsoft.Outlook.Response.CounterPropose

'Microsoft.Outlook.RSS

'Microsoft.Outlook.Post.Read

'Microsoft.Outlook.Post.Compose

'Microsoft.Outlook.Sharing.Read

'Microsoft.Outlook.Sharing.Compose


Check the VB.NET sample handler for sample XML and event handlers. The
samples don't show how to segregate ribbon events in the cases of multiple
open Inspectors.

When you get "control" as an argument for a ribbon event callback you can
use:

If (control.Context Is m_Inspector) Then

to test if your wrapper's Inspector is the same as that ribbon control's
Inspector.
 
K

Ken Slovak - [MVP - Outlook]

The only way to have one addin that supports 2000 - 2007 would be either to
not support the ribbon or to code the addin in C++. VB, VB.NET and C# can't
do it.
 
K

Ken Slovak - [MVP - Outlook]

Oh, and make sure you download and review all the sample docs for the ribbon
and the XML for it from MSDN, you're going to need it.
 
S

Sanjay Singh

Hi Ken

As always, thank you for your help.
I look forward to the sample code (when ready).

In the meantime, we will work through the information you sent.

Regards
Sanjay Singh

Ken Slovak - said:
The only way to have one addin that supports 2000 - 2007 would be either
to not support the ribbon or to code the addin in C++. VB, VB.NET and C#
can't do it.




Patrick Schmid said:
The key question is: Do you need one add-in that supports 2000-2007, or
can you split it into two: one for 2000-2003 and one for 2007?

Have you looked at the RibbonX stuff and understand how do it with
VB.NET?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 Beta 2 Technical Refresh (B2TR):
http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007: http://pschmid.net/office2007/customize
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
 
N

n777krish

Hello,

I am trying to add buttons to the RibbonX in Outlook 2007 using VB 6.0.

I have added buttons to the RibbonX control successfully in an Add-in.
I have put in Callback functions in the Addin to display just a message
box.

I have loaded the XML in "IRibbonExtensibility_GetCustomUI(ByVal
RibbonID As String) As String" function that is in the Connect class.
The Button gets displayed on the Ribbon.

I have a few questions about things I dont understand from the sample
VB .NET code:

1. Currently I have callback functions in the connect class that
displays the message box. How would I be able to put the Click event
handler into the Inspector Wrap class that I have?

I will need to create buttons in code to include the Click event
handler. How do I relate the Callbacks in the Connect class with the
click event handler in the Inspector wrap?

2. If I generate buttons using code, they will be added to the Add-ins
tab, as indicated by the documentation. How do I add buttons using code
onto the first Tab of the Inspector? Is this possible without loading
the XML?

3. Will I be able to this:
Create the CommandBar by loading the XML. Then get a reference to the
CommandBar using Code and Add buttons to this reference object that I
get. This way I will be able to get Click event handlers using Code.

Is this going to work?


I would really appreciate the help and guidance. I am not too familiar
with VB .NET and that is making it a bit difficult to understand all
the samples.

Regards,
Neil Goundar.
 
N

News

Hello,

I am trying to add buttons to the RibbonX in Outlook 2007 using VB 6.0.

I have added buttons to the RibbonX control successfully in an Add-in.
I have put in Callback functions in the Addin to display just a message
box.

I have loaded the XML in "IRibbonExtensibility_GetCustomUI(ByVal
RibbonID As String) As String" function that is in the Connect class.
The Button gets displayed on the Ribbon.

I have a few questions about things I dont understand from the sample
VB .NET code:

1. Currently I have callback functions in the connect class that
displays the message box. How would I be able to put the Click event
handler into the Inspector Wrap class that I have?

I will need to create buttons in code to include the Click event
handler. How do I relate the Callbacks in the Connect class with the
click event handler in the Inspector wrap?

2. If I generate buttons using code, they will be added to the Add-ins
tab, as indicated by the documentation. How do I add buttons using code
onto the first Tab of the Inspector? Is this possible without loading
the XML?

3. Will I be able to this:
Create the CommandBar by loading the XML. Then get a reference to the
CommandBar using Code and Add buttons to this reference object that I
get. This way I will be able to get Click event handlers using Code.

Is this going to work?


I would really appreciate the help and guidance. I am not too familiar
with VB .NET and that is making it a bit difficult to understand all
the samples.

Regards,
Neil Goundar.

Ken Slovak - said:
The only way to have one addin that supports 2000 - 2007 would be either
to not support the ribbon or to code the addin in C++. VB, VB.NET and C#
can't do it.




Patrick Schmid said:
The key question is: Do you need one add-in that supports 2000-2007, or
can you split it into two: one for 2000-2003 and one for 2007?

Have you looked at the RibbonX stuff and understand how do it with
VB.NET?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 Beta 2 Technical Refresh (B2TR):
http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007: http://pschmid.net/office2007/customize
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
 
P

Patrick Schmid [MVP]

1. I'll leave that up to Ken ;)
2. If you use the CommandBars model, then you are confined to the
Add-Ins tab. If you want to add your buttons anywhere else, you'll need
to use RibbonX (the XML stuff).
3. A CommandBar cannot be created via RibbonX. CommandBars and RibbonX
are two very different worlds that basically don't work with each other.
Whatever is created via RibbonX is not accessible as CommandBar.
You'll have to create all your buttons via RibbonX and provide
appropriate callbacks in the RibbonX code. Basically, everything on the
Ribbon needs to be done via RibbonX. So you specify in RibbonX what
things should look like, and what methods should be called as a reaction
to events.

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 Beta 2 Technical Refresh (B2TR):
http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007: http://pschmid.net/office2007/customize
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

Hello,

I am trying to add buttons to the RibbonX in Outlook 2007 using VB 6.0.

I have added buttons to the RibbonX control successfully in an Add-in.
I have put in Callback functions in the Addin to display just a message
box.

I have loaded the XML in "IRibbonExtensibility_GetCustomUI(ByVal
RibbonID As String) As String" function that is in the Connect class.
The Button gets displayed on the Ribbon.

I have a few questions about things I dont understand from the sample
VB .NET code:

1. Currently I have callback functions in the connect class that
displays the message box. How would I be able to put the Click event
handler into the Inspector Wrap class that I have?

I will need to create buttons in code to include the Click event
handler. How do I relate the Callbacks in the Connect class with the
click event handler in the Inspector wrap?

2. If I generate buttons using code, they will be added to the Add-ins
tab, as indicated by the documentation. How do I add buttons using code
onto the first Tab of the Inspector? Is this possible without loading
the XML?

3. Will I be able to this:
Create the CommandBar by loading the XML. Then get a reference to the
CommandBar using Code and Add buttons to this reference object that I
get. This way I will be able to get Click event handlers using Code.

Is this going to work?


I would really appreciate the help and guidance. I am not too familiar
with VB .NET and that is making it a bit difficult to understand all
the samples.

Regards,
Neil Goundar.

Ken Slovak - said:
The only way to have one addin that supports 2000 - 2007 would be either
to not support the ribbon or to code the addin in C++. VB, VB.NET and C#
can't do it.




Patrick Schmid said:
The key question is: Do you need one add-in that supports 2000-2007, or
can you split it into two: one for 2000-2003 and one for 2007?

Have you looked at the RibbonX stuff and understand how do it with
VB.NET?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 Beta 2 Technical Refresh (B2TR):
http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007: http://pschmid.net/office2007/customize
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
 
K

Ken Slovak - [MVP - Outlook]

To add to what Patrick said.

All of the handling of clicks in the ribbon will be handled by an OnAction
callback handler. When the XML for that button is supplied it provides an
OnAction tag with the name of the callback handler (onAction = "MyAction").
In the callback for OnAction the code will look something like this:

Public Sub MyAction(ByVal control As Office.IRibbonControl)

'get the specific button that was clicked
strButtonName = control.Id

'test for Inspector it was clicked in, assuming the wrapper class
exposes an Inspector object
Dim affectedInspector As Outlook.Inspector
Set affectedInspector = control.Context

That will allow you to iterate your Inspector wrapper collection and test
the Inspector exposed by each wrapper class against the Inspector where the
ribbon button was clicked:

If (affectedInspector Is wrapperClass.Inspector) Then

Then you can take whatever action you need to take based on the affected
Inspector and which button was clicked.

All the clicks will be directed to one callback handler no matter what
Inspector was affected. You can, when you find the Inspector, call a public
method in the wrapper class that then calls an internal function in the
wrapper class that handles your click event if you want.

If I want to insert my ribbon tab after the ribbon's Message tab (as an
example) the XML would specify something like this:

<ribbon>
<tabs>
<tab id = "MyTab" label = "My Tab" visible = "True" insertafterMso =
"TabNewMailMessage" >

<! the rest of the xml !>

That's how you can control where your tab is placed. If you want your
controls to be in a built-in tab the XML would specify idMSO =
"TabNewMailMessage" instead of id in the <tab> tag so your controls would
then be added to the Message tab.

That's why I said if you want to work with the ribbon you're going to need
to study the XML information and style docs at the Office developer center
so you know what you're doing.
 
N

n777krish

Hello Ken And Patrick,

Firstly, thank you very much for your help in providing an explanation.

I have already read all the XML documentation and the looked at the
sample add-ins.

My confusion was as follows:

I am currently putting in the callback functions into the Connect class
which implements IRibbonExtensibility.

I needed to confirm that this is appropriate, since coding for Outlook
2003 and below , the buttons were made in the Inspector Wrap class and
event handlers were written within the Inspector Wrap.

Could any one of you confirm the following:
1. The callbacks should be placed into the Connect class that
Implements IRibbonExtensibility.

I have tried to place it outside and it does not work from any other
module or class except the one that Implements IRibbonExtensibility.

Once again, thank you very much for all your assistance to all of us
still figuring out Outlook.

Regards,
Neil Goundar
 
K

Ken Slovak - [MVP - Outlook]

That is correct. The class that implements IDTExtensibility2 is the class
that must implement the Ribbon stuff, and only that class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top