Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Referencing Ranges Quickly (Word 2003 VBA)

    Hi. This is a quick question.

    I have code that loops through a range of paragraphs using myRange.Paragraphs(x) within a For/Next. I need to insert a FormField check-box at the beginning of each paragraph. I'm (basically) using the following:

    myRange.Paragraphs(x).Range.FormFields.Add Range:=beginningoftheparagraph, Type:=wdFieldFormCheckBox

    My question is simply this: For the range argument in the Add method, is there a quick way to reference the beginning of the paragraph without having to declare, set and collapse a range variable just to stick the form field at the beginning of the paragraph? (Obviously, if I use the paragraph.range itself, the whole paragraph gets replaced by the symbol.) Or can someone see the task from a different perspective and suggest a different approach altogether?
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Referencing Ranges Quickly (Word 2003 VBA)

    Try

    ActiveDocument.FormFields.Add Range:=ActiveDocument.Range(myRange.Start, myRange.Start), Type:=wdFieldFormCheckBox

  3. #3
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Referencing Ranges Quickly (Word 2003 VBA)

    Cool name, cool country, mad skills... Hans, you are the man!
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

Posting Permissions

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