Consulting

Results 1 to 3 of 3

Thread: Selecting a field

  1. #1
    VBAX Regular YossiD's Avatar
    Joined
    Jan 2009
    Posts
    34
    Location

    Selecting a field

    I'm trying to write a macro that will select the next REF field in a document so I can apply a specific style. A recorded macro gave me this command to go to the next REF field:
    Selection.GoTo What:=wdGoToField, Which:=wdGoToNext, Count:=1, Name:="REF"
    That puts the cursor just before the field. Now I just need to select the field. I'm sure it's simple but I can't figure out how to do that.

  2. #2
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    If you want to apply particular formatting to the field(s), why don't you just add a \* Charformat switch to them, along with formatting the 'R' in REF to suit? None of this requires the field to be selected.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,273
    Location
    Cross-posted at: VBA to select a field in MS Word - Microsoft Community
    Please read VBA Express' policy on Cross-Posting in Rule 3: http://www.vbaexpress.com/forum/faq...._new_faq_item3
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •