Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Dec 2000
    Location
    Montreal, Quebec, Canada
    Posts
    115
    Thanks
    0
    Thanked 0 Times in 0 Posts

    screenupdating false = range? (Office 2000)

    Hi,
    I wrote a macro that add a line below the current paragraph. Works just fine until I add screenupdating = false at the beginning and true at the end. The line then appears to set its anchor at the upper left corner of the page. It can't find the range anymore. Any clue?

    tks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: screenupdating false = range? (Office 2000)

    Could you post the code you currently have?

  3. #3
    2 Star Lounger
    Join Date
    Dec 2000
    Location
    Montreal, Quebec, Canada
    Posts
    115
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: screenupdating false = range? (Office 2000)

    OK that's weird. Just before posting the code to you I decided to tiddy up the code a bit and I nested a With End With just so my code would look better and it works just fine now. I don't understand but it works.
    Here is what I had.

    Application.ScreenUpdating = False
    Selection.Style = ActiveDocument.Styles("Heading 1")
    Set T1Range = Selection.Paragraphs(1).Range
    Set T1Line = ActiveDocument.Shapes.AddLine(96#, 256.5, 554.25, 256.5, T1Range)
    With T1Line.Line
    .Weight = 1.5
    .DashStyle = msoLineSolid
    .Style = msoLineSingle
    ' . . . etc.
    End With
    With T1Line
    .Height = 0#
    .Width = InchesToPoints(6.14)
    '. . . etc.
    End With
    Application.ScreenUpdating = True

    Here is what I changed it for

    Application.ScreenUpdating = False
    Selection.Style = ActiveDocument.Styles("Heading 1")
    Set T1Range = Selection.Paragraphs(1).Range
    Set T1Line = ActiveDocument.Shapes.AddLine(96#, 256.5, 554.25, 256.5, T1Range)
    With T1Line
    .Height = 0#
    .Width = InchesToPoints(6.14)
    '. . . etc.
    With .Line
    .Weight = 1.5
    .DashStyle = msoLineSolid
    ' . . . etc.
    End With
    End With
    Application.ScreenUpdating = True

    Works just fine now. I just cleaned up before the cleaning lady came. <img src=/S/smile.gif border=0 alt=smile width=15 height=15> Tks.

Posting Permissions

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