+ Reply to Thread
Results 1 to 2 of 2

Word.Range

Hybrid View

Guest Word.Range 01-24-2006, 09:20 AM
Guest Re: Word.Range 01-24-2006, 10:35 AM
  1. #1
    Soniya
    Guest

    Word.Range

    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


  2. #2
    paul.robinson@it-tallaght.ie
    Guest

    Re: Word.Range

    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


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1