Results 1 to 5 of 5
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    code to change text orientation not working (WordXP)

    Hi

    I have been working on the following code - within a table column change the text orientation to either Orientation = wdTextOrientationUpward, or .Orientation = wdTextOrientationHorizontal.
    when the code changes the text orientation to horizontal, the result is in the actual column the text is still upward. however when i goto the word menu Format> Text direction>in the orientation section the picture of the text is displayed as Horizontal.

    i've used code selection & ranges - still no success. - any ideas? Diana


    If optLandscape Then
    With Selection
    .Orientation = wdTextOrientationUpward
    .Font.Name = "Arial"
    .Font.Size = 18
    .Font.Bold = True
    .ParagraphFormat.Alignment = wdAlignParagraphCenter
    .ParagraphFormat.SpaceBefore = 30
    .MoveLeft Unit:=wdCharacter, Count:=1
    End With
    ElseIf optPortrait Then
    With Selection
    .Orientation = wdTextOrientationHorizontal
    .Font.Name = "Arial"
    .Font.Size = 12
    .Font.Bold = False
    .ParagraphFormat.Alignment = wdAlignParagraphLeft
    .ParagraphFormat.SpaceBefore = 0
    .MoveLeft Unit:=wdCharacter, Count:=1
    End With
    End If


    'if orientation of spine to be landscape - set cursor & format
    If optLandscape = True Then

    Selection.SelectColumn
    Set myrange = Selection.Range

    With myrange
    .Orientation = wdTextOrientationUpward
    End With

    'font formatting
    With myrange.Font
    .Name = "Arial"
    .Size = 18
    .Bold = True
    End With

    'paragraph formatting
    With myrange.ParagraphFormat
    .LineSpacingRule = wdLineSpaceSingle
    .Alignment = wdAlignParagraphCenter
    .SpaceBefore = 30
    .SpaceAfter = 0
    .LeftIndent = CentimetersToPoints(0)
    .RightIndent = CentimetersToPoints(0)
    End With
    Selection.HomeKey Unit:=wdLine

    'if orientation of spine to be portrait - set cursor & format
    ElseIf optPortrait = True Then

    Selection.SelectColumn
    Set myrange = Selection.Range

    With myrange
    .Orientation = wdTextOrientationHorizontal
    End With

    ''font formatting
    With myrange.Font
    .Name = "Arial"
    .Size = 10
    .Bold = False
    End With

    ''paragraph formatting
    With myrange.ParagraphFormat
    .Alignment = wdAlignParagraphCenter
    .SpaceBefore = 0
    .SpaceAfter = 0
    .LeftIndent = CentimetersToPoints(0)
    .RightIndent = CentimetersToPoints(0)
    End With

    Selection.HomeKey Unit:=wdLine
    End If

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: code to change text orientation not working (W

    This code works as expected in a two column table in Word 2002 SP3. The Text Direction dialog is right on.
    <pre>Sub Macro1()
    With Selection
    .Orientation = wdTextOrientationUpward
    .MoveRight Unit:=wdCell
    .Orientation = wdTextOrientationDownward
    End With
    End Sub</pre>

    But perhaps my "Selection" is different than yours. I just had a single word in each cell. Anything special going on in your table??

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: code to change text orientation not working (W

    hey jefferson

    please find a document created from my template. i just use one word to test with.
    i tried your code it didnt work. maybe you can pick up something that i cant see.

    diana

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: code to change text orientation not working (W

    I tried both your selection-based and range-based code and everything I tried worked properly. Very mysterious!

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: code to change text orientation not working (W

    hey jefferson....yeah thanks for that, i tried with some other code & it worked....many thanks diana

Posting Permissions

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