Advertisement

08.16.2007 at 01:36PM PDT, ID: 22768275
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.2

Customizing MS Word 2007 RibbonX - ComboBox OnChange doesn't fire

Asked by megnin in Microsoft Office Suite, Extensible Markup Language (XML), Microsoft Visual Basic.Net

Tags: , ,

I'm creating a custom Ribbon menu for MS Word 2007.  I have some working buttons that open specific documents.  I'm having trouble with a ComboBox, however.

For the Buttons, I'm using "OnAction" and for the ComboBox, "OnChange".

The buttons work fine.  The ComboBox does nothing and I can't figure out why.

Here is the Ribbon.xml:

<?xml version="1.0" encoding="utf-8" ?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon startFromScratch="false">
    <tabs>
      <!--<tab idMso="TabHome" >
      <group id="group1" insertAfterMso="GroupClipboard"  label="Document Templates">
      <button id="button1" imageMso="MailMergeAddressBlockInsert" label="WF1 Letterhead" onAction="OnAction" size="normal" />
            <button id="button3" imageMso="MailMergeGreetingLineInsert" label="For Pre-Printed Stock" onAction="OnAction" size="normal" />
            <button id="button4" imageMso="FilePrepareMenu"  label="MEMO Template" onAction="OnAction" size="normal" />
            <button id="button5" imageMso="EnvelopesAndLabelsDialog" label="Envelope Template" onAction="OnAction" size="normal" />
            <button id="button6" imageMso="PageSetupPageDialog" label="FAX Cover Sheet" onAction="OnAction" size="normal" />-->
      <tab id="tab1" label="WorkForce One" >
        <group id="group1" label="Document Templates">
          <button id="button1" imageMso="MailMergeAddressBlockInsert" label="WF1 Letterhead" onAction="OnAction1" size="large" />
          <button id="button3" imageMso="MailMergeGreetingLineInsert" label="For Pre-Printed Stock" onAction="OnAction2" size="large" />
          <button id="button4" imageMso="FilePrepareMenu"  label="MEMO Template" onAction="OnAction3" size="large" />
          <button id="button5" imageMso="EnvelopesAndLabelsDialog" label="Envelope Template" onAction="OnAction4" size="large" />
          <button id="button6" imageMso="PageSetupPageDialog" label="FAX Cover Sheet" onAction="OnAction5" size="large" />

          <comboBox id="ComboBox1" label="Department Memos" onChange="OnChange1" supertip="Select your Department to open the Memo Template">
            <item id="item1" label="Executive" />
            <item id="item2" label="Fiscal" />
            <item id="item3" label="Human Resources" />
            <item id="item4" label="Legal" />
            <item id="item5" label="Communications" />
            <item id="item6" label="Operations" />
            <item id="item7" label="MIS" />
            <item id="item8" label="Quality Assurance" />
            <item id="item9" label="Business Services" />
          </comboBox>

          <dialogBoxLauncher>
            <button id="button99" screentip="Select a Standard WorkForce One Document Template" onAction="OnAction" />
          </dialogBoxLauncher>
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

==================================================================
And here is the Connect.vb
==================================================================
Imports Extensibility
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Core
Imports Word = Microsoft.Office.Interop.Word
Imports System.Reflection
Imports System.IO


#Region " Read me for Add-in installation and setup information. "
' When run, the Add-in wizard prepared the registry for the Add-in.
' At a later time, if the Add-in becomes unavailable for reasons such as:
'   1) You moved this project to a computer other than which is was originally created on.
'   2) You chose 'Yes' when presented with a message asking if you wish to remove the Add-in.
'   3) Registry corruption.
' you will need to re-register the Add-in by building the $SAFEOBJNAME$Setup project,
' right click the project in the Solution Explorer, then choose install.
#End Region

<GuidAttribute("667C25F7-F791-4A19-A323-7ECD95EF5D86"), ProgIdAttribute("WF1Ribbon.Connect")> _
Public Class Connect
      
    Implements Extensibility.IDTExtensibility2
    Implements IRibbonExtensibility

    Private applicationObject As Word.Application
    Dim addInInstance As Object

    Public Sub OnAction1(ByVal IRibbonControl As Object)
        applicationObject.Documents.Add("S:\Marketing\MSMENU\letterhead.doc")
        Dim NewPath As String
        NewPath = ("F:\")
        My.Computer.FileSystem.CurrentDirectory = NewPath
    End Sub
    Public Sub OnAction2(ByVal IRibbonControl As Object)
        applicationObject.Documents.Add("S:\Marketing\MSMENU\letterheadpre.doc")
        Dim NewPath As String
        NewPath = ("F:\")
        My.Computer.FileSystem.CurrentDirectory = NewPath
    End Sub
    Public Sub OnAction3(ByVal IRibbonControl As Object)
        applicationObject.Documents.Add("S:\Marketing\MSMENU\memo.doc")
        Dim NewPath As String
        NewPath = ("F:\")
        My.Computer.FileSystem.CurrentDirectory = NewPath
    End Sub
    Public Sub OnAction4(ByVal IRibbonControl As Object)
        applicationObject.Documents.Add("S:\Marketing\MSMENU\envelope.doc")
        Dim NewPath As String
        NewPath = ("F:\")
        My.Computer.FileSystem.CurrentDirectory = NewPath
    End Sub
    Public Sub OnAction5(ByVal IRibbonControl As Object)
        applicationObject.Documents.Add("S:\Marketing\MSMENU\fax.doc")
        Dim NewPath As String
        NewPath = ("F:\")
        My.Computer.FileSystem.CurrentDirectory = NewPath
    End Sub
    Public Sub OnChange1(ByVal IRibbonControl As Object)
        applicationObject.Documents.Add("S:\Marketing\MSMENU\memo.doc")

    End Sub

    Public Sub OnBeginShutdown(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnBeginShutdown
    End Sub

    Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnAddInsUpdate
    End Sub

    Public Sub OnStartupComplete(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnStartupComplete
    End Sub

    Public Sub OnDisconnection(ByVal RemoveMode As Extensibility.ext_DisconnectMode, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnDisconnection
    End Sub

    Public Sub OnConnection(ByVal application As Object, ByVal connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnConnection
        applicationObject = DirectCast(application, Word.Application)
        addInInstance = addInInst
    End Sub

    Public Function GetCustomUI(ByVal RibbonID As String) As String Implements Microsoft.Office.Core.IRibbonExtensibility.GetCustomUI
        Dim asm As Assembly = Assembly.GetExecutingAssembly()
        Dim stream As Stream = asm.GetManifestResourceStream("WF1Ribbon.Ribbon.xml")
        Dim reader As New StreamReader(stream)
        Dim Ribbon As String = reader.ReadToEnd
        reader.Close()
        stream.Close()
        'Return Ribbon

        Return My.Resources.Ribbon
    End Function
End Class
===============================================================

The ComboBox OnChange1 event is at line 58 of Connect.vb.  I just put one action in it to test before I add the logic to open a different document for each selection.

What have I missed?

Thanks.Start Free Trial
 
Loading Advertisement...
 
[+][-]08.19.2007 at 09:05PM PDT, ID: 19728208

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2007 at 01:36PM PDT, ID: 19733546

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Office Suite, Extensible Markup Language (XML), Microsoft Visual Basic.Net
Tags: combobox, word, ribbonx
Sign Up Now!
Solution Provided By: megnin
Participating Experts: 1
Solution Grade: B
 
 
[+][-]08.20.2007 at 07:24PM PDT, ID: 19735132

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.22.2007 at 04:15PM PDT, ID: 19750379

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.23.2007 at 05:34AM PDT, ID: 19753606

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.26.2007 at 04:40AM PDT, ID: 19770702

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628