Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word 2010 Backstage addin

Status
Not open for further replies.

SAToronto

IS-IT--Management
Sep 21, 2011
199
CA
1st off let me say my experience with programming is limited so please go easy on me :)
Background Info:
I currently push workgroup templates via a GPO based on city OU. When a user selects file tab>new>my templates, the new from template box comes up, with a tab for each template type. Each city has 9 different template types which are pretty much the same but do have differences based on city and provincial regulations. We are at the point now where about 30% of my users need access to all city templates as projects are now shared between cities. Previously we were allowing the users to browse the share to use templates from other cities, but found they were just copying them all to the desktop, and they were always using templates that werent current. I tried implementing the solution found here but you cant have a folder structure and the user would have to scroll through all template types
I have created a com addin that adds a tab to word 2010 backstage.
From different sample code and some patience I have managed to get as far as a new tab. On this tab I have 2 groups in 1 column, with 2 combo boxes and 1 button in grp1. cbo1 is populated with all the cities we have a presence in cbo2 is populated with all the different word template types (engineering, project admin and so on). Can anyone point me along the way so that when a users selects a city and template type, then clicks the view templates button the returned templates will show up in grp2(available templates)? I guess I am looking for the same type of behaviour that the above technet article produces when it resolves the ServiceURL and reads the template configuration XML. I am not sure if it should be done from the XML file or fron the connect.vb file that was created when I made the project in VS2010 from other project types>extensibility>shared add-in

Here is my code from the XML

<?xml version="1.0" encoding="utf-8" ?>
<customUI xmlns=" <backstage>
<tab id="customTab" label="S + A Templates" insertAfterMso="TabInfo" >
<firstColumn>
<group id="customGroup" label="S+A Templates">
<primaryItem>
<button id="btnButton" label="View Templates" imageMso="Folder" onAction="OnAction"/>
</primaryItem>
<topItems>
<layoutContainer id="layoutTwo" layoutChildren="horizontal">
<comboBox id="cboComboBox" label="Select City" >
<item id="item1" label="Toronto"/>
<item id="item2" label="Ottawa"/>
<item id="item3" label="Edmonton"/>
<item id="item4" label="Burnaby"/>
<item id="item5" label="Kelowna"/>
<item id="item6" label="Victoria"/>
</comboBox>
<comboBox id="cboComboBox2" label="template Type" >
<item id="item7" label="01-Proposal"/>
<item id="item8" label="02-Project Admin"/>
<item id="item9" label="03-Permit Docs"/>
<item id="item10" label="04-Construction Admin"/>
<item id="item11" label="05-Inter-Office"/>
<item id="item12" label="06-Prime Consultant"/>
<item id="item13" label="07-CheckLists"/>
<item id="item14" label="08-FootPrint"/>
<item id="item15" label="09-Test-Dont Use"/>
</comboBox>
</layoutContainer>
</topItems>
</group>
<group id="grpTwo" label="Available Templates" visible="true" >
</group>

</firstColumn>
</tab>
</backstage>
</customUI>


Here is my code from connect.vb

imports Extensibility
Imports System.Runtime.InteropServices Imports Office = Microsoft.Office.Core
Imports Word = Microsoft.Office.Interop.Word




<GuidAttribute("D09E2A2F-1A72-431F-AEB9-1EF84E533420"), ProgIdAttribute("BackstageComAddin.Connect")> _
Public Class Connect

Implements Extensibility.IDTExtensibility2, Office.IRibbonExtensibility

Private applicationObject As Word.Application

Private addInInstance As Object

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 = application
addInInstance = addInInst
End Sub
Public Function GetCustomUI(ByVal RibbonID As String) As String Implements Microsoft.Office.Core.IRibbonExtensibility.GetCustomUI
Return BackStageCOMAddin.My.Resources.customUI
End Function

Sub OnAction(ByVal control As Office.IRibbonControl)
MessageBox.Show("Please select from available Templates")
End Sub

End Class

Thanks in advance to all that may help!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top