Word.Range

S

Soniya

Hi all,

I found several post here describing how to declare a range in Word.
But when itried to declare a word range (Dim myRange As Word.Range) it
gives me an error !?

I am using office 2003 with windows xp.

I could not select a paragraph in word for formatting or my desired
format does not work in word.

With WDApp
.Documents.Add
With .Selection
.TypeText Text:=A
.Font.Name = "Simplified Arabic"
.Font.Size = 18
.Font.Bold = True

.ParagraphFormat.Alignment = 1

.TypeParagraph

.ParagraphFormat.Alignment = 2
.TypeParagraph
.Font.Size = 14
.Font.Bold = False
.Font.Name = "Simplified Arabic"
.TypeText Text:=B
.TypeParagraph

If CmbPrint = "Arabic + Malayalam" Then
.TypeParagraph
.ParagraphFormat.Alignment = 0
.Font.Size = 14
.Font.Bold = False
.Font.Name = "ML-TTKarthika"
.TypeText Text:=C

ElseIf CmbPrint = "Arabic + English" Then
.TypeParagraph
.ParagraphFormat.Alignment = 0
.Font.Name = "Times New Roman"
.Font.Bold = False
.Font.Size = 11
.TypeText Text:=C

ElseIf CmbPrint = "Arabic + Urdu" Then '
.TypeParagraph
.ParagraphFormat.Alignment = 2
.Font.Name = "HUrdu Nastaliq"
.Font.Bold = False
.TypeText Text:=C
.Font.Size = 16
End If

End With

Here Arabic and Urdu are right to left and English and Malayalam left
to right

When it write the data to word one my fist part (text A) only three
charecters are font size 18 and remaining default. Also text B and C
also not giving me desired formatting.

any help?

TIA
Soniya
 
P

paul.robinson

Hi
Don't know how much help this might be but one way to specify a range
is

Set Testdoc = WDApp.Documents.Add
With Testdoc
.Activate
Set myRange = .Range(.Paragraphs(1).Range.Start,
..Paragraphs(4).Range.End)
end with

gives you a range object consisting of everything from the start of
Paragraph(1) to the end of Paragraph(4).
Now try a With myRange... instead of selection.

Completely untested!
regards
Paul
 

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