-
Jan 30th, 2012, 04:45 PM
#1
Thread Starter
New Member
[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?
-
Jan 30th, 2012, 04:59 PM
#2
Thread Starter
New Member
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)
-
Jan 31st, 2012, 04:32 AM
#3
Re: (Word)Stuck programming macros
how about
vb Code:
for i = 1 to 35 Selection.TypeParagraph 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
-
Jan 31st, 2012, 12:01 PM
#4
Thread Starter
New Member
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?
-
Jan 31st, 2012, 03:16 PM
#5
Re: (Word)Stuck programming macros
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|