View Single Post
 
Old 01-20-2014, 08:48 AM
Charles Kenyon Charles Kenyon is offline Windows 7 64bit Office 2010 32bit
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,454
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by deepgreen View Post

Is there any way to automate the Ctrl+Shift+F11 step?. The user will almost certain forget to do it.
Yes. It is called a macro.

You could include a MacroButton Field as a part of your AutoText entry. That could run a macro which deletes the macrobutton field and unlinks your fields that are entered.

You could have a QAT button in your template to run a macro that itserts your AutoText and unlinks the fields.

You could have your own AutoText gallery in your template and have a macro or macros that use that gallery in a custom ribbon tab. Customize the Ribbon (It doesn't take rocket science)

This stuff can all be done. It depends on how much work you want to do. It may be simpler to train the user.

Quote:
Originally Posted by deepgreen View Post
Other question: I am really concern about the user experience, until now I just distribute a Word template (dotx) and all works wonderful. No special authorization or security warnings are shown. If I use a macro could I expect some warning.
This all depends on the level of control you have over the user settings. First, you do NOT want macro blocking turned off. You want your template and its code to be trusted. Can you put your template in a trusted location? Can you sign your template so that it will be trusted by the user's system?

If you can get a macro to run the on-close event would work as a' handler so you would not have to get the user to intentionally do anything (except perhaps to allow macros to run).

Graham Mayor has a page on Installing Macros that includes a macro to update all fields in a document. That could be converted to unlink Date fields. Note, it would unlink all date fields.

Here is one I have not tested. It could be called by the document close event.

Code:
Private Sub DateFieldUnlinkAllStory()
'   Written by Charles Kyle Kenyon 20 January 2014
'   help from Jezebel
'   All Story Date Field Unlinker
    Dim oField As Field
    Dim oStory As Range
'    On Error Resume Next
    For Each oStory In ActiveDocument.StoryRanges
    ' This goes into headers and footers as well as the regular document
        Do
            For Each oField In oStory.Fields
                If oField.Type = wdFieldDate Then
                    oField.Unlink
                End If
            Next oField
            Set oStory = oStory.NextStoryRange
        Loop Until oStory Is Nothing
    Next oStory
End Sub
That would not change CreateDate, SaveDate, or PrintDate fields.
Reply With Quote