Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Word.Range

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Soniya - 24 Jan 2006 13:14 GMT
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
paul.robinson@it-tallaght.ie - 24 Jan 2006 14:29 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.