Repeat code on each page

J

Josha

Hi,

I am new to VB and still getting a handle on things. This is being done in
MSWord How do I repeat the below code for each new odd numbered page. If this
requires the use of line numbers instead of paragraph numbers to set the
range, see the remark in code.

Josha

Code:
Sub Test3()

Dim pChar As Variant
Set myDoc = ActiveDocument

'The following example creates a Range object beginning at the start
'of the second paragraph and ending after the third paragraph.
'The corresponding line numbers that need to be used are ln10 to ln15.
'The code must be repeated for each odd numbered page.

Set myRange = myDoc.Range(Start:=myDoc.Paragraphs(2).Range.Start , _
End:=myDoc.Paragraphs(5).Range.End)


For Each pChar In myRange.Characters
If pChar Like "[A-Z]" Then
pChar.Select
Selection.Range.Case = wdTitleWord
End If
Next


End Sub


--------------------------------------------------------------------------------
 
C

Cindy M.

OP has received a reply to the duplicate question in the
word.vba.general newsgroup

Cindy Meister
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top