MsOf07 [RESOLVED] (Word)Stuck programming macros-VBForums
Results 1 to 5 of 5

Thread: [RESOLVED] (Word)Stuck programming macros

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    3

    Resolved [RESOLVED] (Word)Stuck programming macros

    I have very specific needs for the forms I'm creating. Currently, I have two problems.

    1. I need to mimic the "goto" function from Word Perfect (where the document would add returns until it got to the appropriate line). The "goto" function in Word doesn't do that unless the line number already exists, and that doesn't help me. Any ideas?

    2. I need to insert macros that I have already created that have two columns into a two columned section, basically "nesting" the columns. Any ideas?

  2. #2

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    3

    Re: (Word)Stuck programming macros

    An example of my first problem is here:

    Selection.TypeParagraph
    Selection.TypeText Text:= _
    "II. The above captioned property is subject to the followi"
    Selection.TypeText Text:="ng conveyances and encumbrances:"
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeText Text:="@"
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.Font.Bold = wdToggle
    ' Bold on
    Selection.TypeText Text:="Company, Inc."
    Selection.Font.Bold = wdToggle

    Instead of all the "Selection.TypeParagraph" lines, I'd like something simliar to a loop or if-then statement to start the bold and next text at line 35 (for example)

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    19,591

    Re: (Word)Stuck programming macros

    how about
    vb Code:
    1. for i = 1 to 35
    2.    Selection.TypeParagraph
    3. next
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    3

    Re: (Word)Stuck programming macros

    westconn1 - Thanks for the suggestion, but I was hoping to do this without creating a variable. The other people who will update the code after I'm gone wouldn't understand that...also, I need to use this loop in multiple macros, so the stuff before the break in my form starts on a different line in each form. Does that make sense?

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    19,591

    Re: (Word)Stuck programming macros

    Does that make sense?
    not at all
    but I was hoping to do this without creating a variable.
    you have to have some counter or other way to know when to stop, you could have a do loop.till some criteria, but it is really the same thing

    The other people who will update the code after I'm gone
    they can dig you up to fix it
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.