Thread: [Solved] ASK and REF field problem
View Single Post
 
Old 05-26-2011, 01:13 AM
ilkks ilkks is offline Windows Vista Office 2007
Novice
 
Join Date: May 2011
Posts: 23
ilkks is on a distinguished road
Default

Thanks Paul for your reply.

Since I am so keen on Macrobuttons I put these {}-fields next to each other




{ Macrobutton AutoOpen Double-click Me }{ASK BkMk "Write your name here" \d {DOCPROPERTY Author}}}

And edited AutoOpen-macro a bit so it updates only {REF BkMK}-fields:

Code:
Sub AutoOpen()

'Updates/launches ASK-field next to Macrobutton
Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.Fields.Update

'Updates only REF-fields with bookmark named BkMk
    Dim Fld As Field
With ActiveDocument
  For Each Fld In .Fields
    With Fld
      If .Type = wdFieldRef Then
        If Split(Trim(.Code.Text), " ")(1) = "BkMk" Then .Update
      End If
    End With
  Next
End With

End Sub
I was wondering could the inserted bookmark become the DisplayText for the MacroButton, similar to thread https://www.msofficeforums.com/vba/7...html#post18034

Then there would be one extra line to the AutoOpen-macro, something like this:

Code:
Selection.Fields(1).Code.Text = "MACROBUTTON AutoOpen " & BkMk
But I don't know the correct format for BkMk-bookmark.

Last edited by ilkks; 05-26-2011 at 03:32 AM.
Reply With Quote