none
Multiple templates in Startup folder RRS feed

  • Question

  • I have two templates that I have created. When I put one or the other into my Startup folder and open Word the macros work perfectly. But if I put both of them into the Startup folder together, then the macros stop working. I am using Word 2010 with Windows 7. Does anyone have ideas why this would be happening?

    Friday, July 1, 2011 7:19 PM

Answers

  • I changed the name on one of them and it still did not work.

    But in the XML you show us, the name of the onAction is still the same in both cases. You did test by changing the name and changing the onAction, didn't you? It would probably be wise to leave it that way and not change it back...
    Cindy Meister, VSTO/Word MVP
    • Marked as answer by fuzzhead58 Thursday, July 7, 2011 4:55 PM
    Thursday, July 7, 2011 4:42 PM
    Moderator

All replies

  • Do the two templates contain macros that have the same name? If yes, Word probably can't resolve the name conflict, as you probably also didn't rename either the template project or the code module in which the macros reside...
    Cindy Meister, VSTO/Word MVP
    Saturday, July 2, 2011 9:29 AM
    Moderator
  • Hi Cindy,

    Thanks for the response. My project names are different. One is named Styles and the other is PlannerMacros. Even the macro names inside the projects are different. Also in the Modules folder my ribbon control is named differently. One is named RibbonControl and the other is RibbonControls.

    Sunday, July 3, 2011 6:32 PM
  • Mmm. So when you say "the macros stop working" this means that clicking Ribbon buttons doesn't run the macros, but you've not tested this any other way. Do I understand that correctly?

    Do you have any macros in either of the templates that are "simple Sub" macros (are public and don't take any arguments)? Or can you make a simple Sub that just shows a message box, for testing purposes?

    Link such a macro to a keyboard shortcut, making sure to save that shortcut in the template containing the macro. (File/Options, the one to customize the Ribbon (not the QAT), click keyboard shortcuts.) Close and save that template, quit Word, then start it again. Can you run that simple macro using the keyboard shortcut?

    This will tell us if the problem is that the macros are getting disabled, or if the disconnect has something to do with the Ribbon buttons not triggering the macros.


    Cindy Meister, VSTO/Word MVP
    Monday, July 4, 2011 10:30 AM
    Moderator
  • I will try this on THursday when I get back into work and let you know what happens.
    Tuesday, July 5, 2011 6:13 PM
  • Hi Cindy,

     

    It’s in the ribbon. I created a simple macro to open a new document and if I click it through the ribbon it does not run. If I go through Developer, click on Macros, scroll down through the list in macros until I find the one that creates a new document and click it, it runs fine.  

     

    Thursday, July 7, 2011 1:34 PM
  •  

    It’s in the ribbon. I created a simple macro to open a new document and if I click it through the ribbon it does not run. If I go through Developer, click on Macros, scroll down through the list in macros until I find the one that creates a new document and click it, it runs fine.   


    Interesting, but...

    You shouldn't be able to run the same macro from the Ribbon as from the list of macros. A macro linked to the Ribbon requires arguments to be passed into the procedure, something like:

    Public Sub myRibbonMacro(ctl as IRibbonControl)
    End Sub

    And a macro you can run from the list may not have ANY arguments.

    Or are you trying to use buttons defined in the QAT?

    I'm really having trouble picturing the configuration you're using...


    Cindy Meister, VSTO/Word MVP
    Thursday, July 7, 2011 1:52 PM
    Moderator
  • Here is my Styles Ribbon controls:

     

    Option Explicit

    Public myRibbon As IRibbonUI

     

    Sub Onload(ribbon As IRibbonUI)

    Set myRibbon = ribbon

    End Sub

     

    Sub CustRibbonBtn(control As IRibbonControl)

    Select Case control.ID

      Case "button101": Conversion.Styles.RunConversionMacro

      Case "button102": Conversion.Styles.RunABNConversionMacro

      Case "button104": Conversion.Styles.DocumentFormatingWithSignoffLines

      Case "button105": Conversion.Styles.DocumentFormatingWithOutSignoffLines

      Case "button106": Conversion.Styles.DeletePage

      Case "button107": Conversion.Styles.DeleteLastPage

      Case "button108": Conversion.Styles.DelinkMacros

      Case "button109": Conversion.Styles.RelinkMacros

      Case "button110": Conversion.Styles.UpdateToLatestRevision

      Case "button111": Conversion.Styles.ReplaceCoverPage

      Case "button112": Conversion.Styles.NewBlankProcedureDocument

      Case "button103": Conversion.Styles.ReplaceOPSsCoverPage

      Case "button113": Conversion.Styles.Revision

    End Select

    End Sub

     

     

     

    Here is my Planner Ribbon controls:

     

    Option Explicit

    Public myRibbon1 As IRibbonUI

     

    Sub Onload(ribbon As IRibbonUI)

    Set myRibbon1 = ribbon

    End Sub

     

    Sub CustRibbonBtn(control As IRibbonControl)

    Select Case control.ID

      Case "button1": PlannerMacros.Header1

      Case "button2": PlannerMacros.Header2

      Case "button3": PlannerMacros.Header3

      Case "button4": PlannerMacros.Header4

      Case "button5": PlannerMacros.Header5

      Case "button6": PlannerMacros.Header6

      Case "button7": PlannerMacros.cleanliness

      Case "button8": PlannerMacros.Clearance

      Case "button9": PlannerMacros.Confined_Space

      Case "button10": PlannerMacros.FME_Brief

      Case "button11": PlannerMacros.HVAC

      Case "button12": PlannerMacros.ISP

      Case "button13": PlannerMacros.MSDS_Chem_Permit

      Case "button14": PlannerMacros.System_Pressure

      Case "button15": PlannerMacros.Workstep

      Case "button16": PlannerMacros.ASME

      Case "button17": PlannerMacros.OIL_Piping

      Case "button18": PlannerMacros.Opening_system

      Case "button19": PlannerMacros.Torque

      Case "button20": PlannerMacros.Approved_Lubs

      Case "button21": PlannerMacros.Caution

      Case "button22": PlannerMacros.Warning

      Case "button23": PlannerMacros.FME_System

      Case "button24": PlannerMacros.Filter

      Case "button25": PlannerMacros.Housekeeping

      Case "button26": PlannerMacros.ISP_Signoff

      Case "button27": PlannerMacros.Limits_on_Use_Note

      Case "button28": PlannerMacros.Note

      Case "button29": PlannerMacros.PEER_Signature

      Case "button30": PlannerMacros.QC_Inspection

      Case "button31": PlannerMacros.QC_Signature

      Case "button32": PlannerMacros.Refrigerant_Compliance

      Case "button33": PlannerMacros.Repack_Valve

      Case "button34": PlannerMacros.Signoff

      Case "button35": PlannerMacros.Torque

      Case "button36": PlannerMacros.Torque_Table

      Case "button37": PlannerMacros.Weld_valve

      Case "button38": PlannerMacros.Work_Step_NBR

      Case "button39": PlannerMacros.UTC

      Case "button40": PlannerMacros.UTC_supervisor

      Case "button41": PlannerMacros.RevBar

      Case "button42": PlannerMacros.PMT

      Case "button43": PlannerMacros.PMT_Packing

      Case "button44": PlannerMacros.AOV_PMT

      Case "button45": PlannerMacros.Cycle_Valve

      Case "button46": PlannerMacros.Block_Protect

      Case "button47": PlannerMacros.DeleteRevBars

      Case "button48": PlannerMacros.Page_break

      Case "button49": PlannerMacros.Lower_Case

      Case "button50": PlannerMacros.Wordperfect_Setup

      Case "button51": PlannerMacros.PMO_SETUP

      Case "button52": PlannerMacros.Header4WithSignoffLine

      Case "button53": PlannerMacros.Header5WithSignoffLine

      Case "button54": PlannerMacros.Header5WithSignoffLine

    End Select

    End Sub

     

    Thursday, July 7, 2011 2:54 PM
  • I created a shortcut key in my macro to create a new document and it works with both templates in my startup folder. That tells me it's in the ribbon buttons.
    Thursday, July 7, 2011 3:12 PM
  • It might be interesting to see the XML, as well, but this sort of hits me between the eyes:

    Sub CustRibbonBtn(control As IRibbonControl)

     

    is the name of BOTH of the procedures being called from the Ribbon. Try changing it for one and see if that doesn't make a difference...

     

    You'll recall the very first question I asked you was: "Do the two templates contain macros that have the same name? "


    Cindy Meister, VSTO/Word MVP
    Thursday, July 7, 2011 3:17 PM
    Moderator
  • I changed the name on one of them and it still did not work.
    Thursday, July 7, 2011 3:32 PM
  • Styles ribbon info:

     

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">

    <ribbon>

          <tabs>

                <tab id="Tab100" insertBeforeMso="TabHome" label="Procedure Styles Macros">

                      <group id="Grp1" label="Macro Buttons " visible="true">

                            <button id="button101" showLabel="false" label=" " screentip="WordPerfect Conversion"

                            size="large" image="WPp"

                            onAction="CustRibbonBtn" />

                            <button id="button102" showLabel="false" label=" " screentip="ABN Conversion"

                            size="large" image="ABNp"

                            onAction="CustRibbonBtn" />

                            <button id="button103" showLabel="false" label=" " screentip="Replace with NEW OPS Cover Page"

                            size="large" image="OPSs"

                            onAction="CustRibbonBtn" />

                            <button id="button104" showLabel="false" label=" " screentip="Document Formatting With Signoff Lines"

                            size="large" image="DFWSLp"

                            onAction="CustRibbonBtn" />

                            <button id="button105" showLabel="false" label=" " screentip="Document Formatting Without Signoff Lines"

                            size="large" image="DFWOSLp"

                            onAction="CustRibbonBtn" />

                            <button id="button106" showLabel="false" label=" " screentip="Delete Page"

                            size="large" image="DPp"

                            onAction="CustRibbonBtn" />

                            <button id="button107" showLabel="false" label=" " screentip="Delete Last Page"

                            size="large" image="DLPp"

                            onAction="CustRibbonBtn" />

                            <button id="button108" showLabel="false" label=" " screentip="Delink Macros"

                            size="large" image="DLMp"

                            onAction="CustRibbonBtn" />

                            <button id="button109" showLabel="false" label=" " screentip="ReLink Macros"

                            size="large" image="RLMp"

                            onAction="CustRibbonBtn" />

                            <button id="button110" showLabel="false" label=" " screentip="Update To The Latest Revision"

                            size="large" image="LRevp"

                            onAction="CustRibbonBtn" />

                            <button id="button111" showLabel="false" label=" " screentip="Replace The Cover Page"

                            size="large" image="RCPp"

                            onAction="CustRibbonBtn" />

                            <button id="button112" showLabel="false" label=" " screentip="New Blank Procedure Document"

                            size="large" image="ND3"

                            onAction="CustRibbonBtn" />

                            <button id="button113" showLabel="false" label=" " screentip="Revision 11 of Styles Update"

                            size="large" image="Rev11p"

                            onAction="CustRibbonBtn" />

                      </group >

                </tab>

           </tabs>

    </ribbon>

    </customUI>

     

    Thursday, July 7, 2011 3:38 PM
  • I keep geeting a script error when I try to upload all of my planner info. So here is Grp1 of 7.

     

    Planner ribbon info:

     

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">

    <ribbon>

          <tabs>

                <tab id="Tab1" insertBeforeMso="TabHome" label="Planner Macros">

                      <group id="Grp1" label="Numbering" visible="true">

                            <button id="button1" size="normal" label="1.0"

                            screentip="Level 1 Numbering"

                            onAction="CustRibbonBtn" />

                            <button id="button2" size="normal" label="1.1"

                            screentip="Level 2 Numbering"

                            onAction="CustRibbonBtn" />

                            <button id="button3" size="normal" label="1.1.1"

                            screentip="Level 3 Numbering"

                            onAction="CustRibbonBtn" />

                            <button id="button4" size="normal" label="4.1"

                            screentip="Level 4 Numbering"

                            onAction="CustRibbonBtn" />

                            <button id="button5" size="normal" label="4.1.1"

                            screentip="Level 5 Numbering"

                            onAction="CustRibbonBtn" />

                            <button id="button6" size="normal" label="4.1.1.1"

                            screentip="Level 6 Numbering"

                            onAction="CustRibbonBtn" />

                            <button id="button52" size="normal" label="4.1 __"

                            screentip="Level 4 Numbering With Signoff"

                            onAction="CustRibbonBtn" />

                            <button id="button53" size="normal" label="4.1.1 __"

                            screentip="Level 5 Numbering With Signoff"

                            onAction="CustRibbonBtn" />

                            <button id="button54" size="normal" label="4.1.1.1 __"

                            screentip="Level 6 Numbering With Signoff"

                            onAction="CustRibbonBtn" />

                      </group >

    Thursday, July 7, 2011 3:43 PM
  • I changed the name on one of them and it still did not work.

    But in the XML you show us, the name of the onAction is still the same in both cases. You did test by changing the name and changing the onAction, didn't you? It would probably be wise to leave it that way and not change it back...
    Cindy Meister, VSTO/Word MVP
    • Marked as answer by fuzzhead58 Thursday, July 7, 2011 4:55 PM
    Thursday, July 7, 2011 4:42 PM
    Moderator
  • I changed the the name in onAction to be the same new name in Styles RibbonControl and now they work. I learned something new on how the ribbon works. Thank you for teaching me this information Cindy.

    Larry

    Thursday, July 7, 2011 4:54 PM
  • Hi Larry

    <whew>! Glad we got it working :-)

    Note: As I recall, it would be possible to use the same macro name in each template, but then you'd need to fully qualify the "path" to the macros in the onAction attribute. Something like: modStyles.CustRibbonBtn vs. modPlanner.CustRibbonBtn. It's been a while since I did this, which is why I'm purposely being a bit vague about the exact syntax.


    Cindy Meister, VSTO/Word MVP
    Thursday, July 7, 2011 5:28 PM
    Moderator