• Workgroup templates (Office 97/Win XP)

    Author
    Topic
    #411556

    Hello,

    I am preparing some workgroup templates with macros attached. I want to store them on a shared network drive with read-only access for the users and full read-write access for me (as the administrator of the workgroup templates). When users apply the templates and when the document is saved they are prompted with the question: do you want to save the attached template? How can I solve this? They shouldn’t save it at all. Moreover they have no write access.

    Viewing 1 reply thread
    Author
    Replies
    • #893185

      What happens if you put (a copy of) such a template in your User Templates folder and create a document based on it? Do you get prompted to save the template too?

      • #893281

        Hi Hans

        Actually, to be honest, I work with a workgroup template (in the test phase) on a network drive where I have full read-write access. Because I’ve got prompted to save the template, I added a line in the code to automatically save the attached template.

        ActiveDocument.AttachedTemplate.Saved = True

        Now that I want other users to work with this template, I don’t want them to have write access, but I am afraid that it will cause trouble (what will happen if they’ve got prompted with that question?). Maybe I should organise myself to test it, but I wondered if somebody from the forum had experience with this.
        If I put the template in my User Template (where I have full read-write access), I am prompted too to save the template. No difference.

        • #893298

          Templates sometimes are changed by code adjusting menus or toolbars, adding AutoText entries, or other subtle changes. If you can root out those things, it might be preferable to suppressing the dialog.

          • #893306

            Maybe, I should be a little bit more explicit about the macros attached to the template. The template is designed to generate a protocol document for an experiment within an R&D environment. The macro has some functionality in the Document_New and Document_Open events to fire a dialog window which allows the user to fill in document related information, which is stored in an Excel spreadsheet and in the document properties (both general and custom). In addition, new protocol utilities are added to main commandbar of Word (a popup menu). As I understand from your reply, this new popup menu is causing the problem? Does that mean that to avoid Word from prompting to Save the attached template, I should add code like:

            Application.DisplayAlerts = False
            ActiveDocument.AttachedTemplate.Saved = False
            Application.DisplayAlerts = True

            • #893318

              If the CustomizationContext of the CommandBar changes is your workgroup template, try setting the “Temporary” property to True when creating the new bars and/or controls. I’m not sure this will avoid having to save, but it’s worth a try.

            • #893319

              If the CustomizationContext of the CommandBar changes is your workgroup template, try setting the “Temporary” property to True when creating the new bars and/or controls. I’m not sure this will avoid having to save, but it’s worth a try.

            • #894443

              [indent]


              new protocol utilities are added to main commandbar of Word (a popup menu)


              [/indent] If you do this in VBA code every time a document based on that template is created or opened, then this makes the template “dirty”, hence the Save question. I encountered the same problem enabling/disabling a commandbar button depending on a user’s choice. I solved this problem by putting this in a “wrapper” Sub which also sets the Saved status:

              Public Sub EnableCommandbarButton(strBarName As String, strButtonName As String, blnEnable As Boolean)
              Dim ctrl As CommandbarControl
              Dim blnSaved As Boolean
              With ActiveDocument
              blnSaved = .AttachedTemplate.Saved ‘Get the current Saved status
              For Each ctrl In .Commandbars(strBarName).Controls
              If ctrl.Caption = strButtonName Then
              ctrl.Enabled = blnEnable
              Exit For
              End If
              Next ctrl
              .AttachedTemplate.Saved = blnSaved ‘Restore the original Saved status
              End With
              End Sub

            • #894487

              Thanks a lot to all of you.
              Jan , hartstikke bedankt!!

            • #894488

              Thanks a lot to all of you.
              Jan , hartstikke bedankt!!

            • #894444

              [indent]


              new protocol utilities are added to main commandbar of Word (a popup menu)


              [/indent] If you do this in VBA code every time a document based on that template is created or opened, then this makes the template “dirty”, hence the Save question. I encountered the same problem enabling/disabling a commandbar button depending on a user’s choice. I solved this problem by putting this in a “wrapper” Sub which also sets the Saved status:

              Public Sub EnableCommandbarButton(strBarName As String, strButtonName As String, blnEnable As Boolean)
              Dim ctrl As CommandbarControl
              Dim blnSaved As Boolean
              With ActiveDocument
              blnSaved = .AttachedTemplate.Saved ‘Get the current Saved status
              For Each ctrl In .Commandbars(strBarName).Controls
              If ctrl.Caption = strButtonName Then
              ctrl.Enabled = blnEnable
              Exit For
              End If
              Next ctrl
              .AttachedTemplate.Saved = blnSaved ‘Restore the original Saved status
              End With
              End Sub

          • #893307

            Maybe, I should be a little bit more explicit about the macros attached to the template. The template is designed to generate a protocol document for an experiment within an R&D environment. The macro has some functionality in the Document_New and Document_Open events to fire a dialog window which allows the user to fill in document related information, which is stored in an Excel spreadsheet and in the document properties (both general and custom). In addition, new protocol utilities are added to main commandbar of Word (a popup menu). As I understand from your reply, this new popup menu is causing the problem? Does that mean that to avoid Word from prompting to Save the attached template, I should add code like:

            Application.DisplayAlerts = False
            ActiveDocument.AttachedTemplate.Saved = False
            Application.DisplayAlerts = True

        • #893299

          Templates sometimes are changed by code adjusting menus or toolbars, adding AutoText entries, or other subtle changes. If you can root out those things, it might be preferable to suppressing the dialog.

      • #893282

        Hi Hans

        Actually, to be honest, I work with a workgroup template (in the test phase) on a network drive where I have full read-write access. Because I’ve got prompted to save the template, I added a line in the code to automatically save the attached template.

        ActiveDocument.AttachedTemplate.Saved = True

        Now that I want other users to work with this template, I don’t want them to have write access, but I am afraid that it will cause trouble (what will happen if they’ve got prompted with that question?). Maybe I should organise myself to test it, but I wondered if somebody from the forum had experience with this.
        If I put the template in my User Template (where I have full read-write access), I am prompted too to save the template. No difference.

    • #893186

      What happens if you put (a copy of) such a template in your User Templates folder and create a document based on it? Do you get prompted to save the template too?

    Viewing 1 reply thread
    Reply To: Workgroup templates (Office 97/Win XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: