Results 1 to 6 of 6
  1. #1
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Screen Updating (Excel XP SR1)

    These lines came from the ThisWorkbook object. Whenever this workbook is opened (and closed), the user can <font color=blue>see</font color=blue> the results of this code. Is it possible for this code to do its thing behind the scenes? It's tacky when the user can see the formula bar, etc. being restored while the workbook is shutting down.


    <pre>Private Sub Workbook_WindowActivate(ByVal Wn As Window)

    With Application
    .DisplayFormulaBar = False
    .DisplayStatusBar = False
    .DisplayScrollBars = False
    End With
    End Sub
    Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)

    With Application
    .DisplayFormulaBar = True
    .DisplayStatusBar = True
    .DisplayScrollBars = True
    End With

    End Sub</pre>

    - Ricky

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Screen Updating (Excel XP SR1)

    Have you tried putting the following before that code:

    <pre>Application.ScreenUpdating=False
    </pre>

    Legare Coleman

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Screen Updating (Excel XP SR1)

    Whether or not you can move the code depends on what you are trying to accomplish. If you move that code to the Open and Close events, then any other workbooks that are open at the same time as this one wiil use the same settings if they don't have code in their Activate and Deactivate events to set their own settings.
    Legare Coleman

  4. #4
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Screen Updating (Excel XP SR1)

    So, the advantage of leaving that code in the Activate and DeActivate routines is to restrict the changes to that workbook?

    If so, then I'm back to adding the <font color=blue>ScreenUpdating False & True</font color=blue> lines to DeActivate to eliminate the visual effects when restoring the formual bar, etc.
    - Ricky

  5. #5
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Screen Updating (Excel XP SR1)

    Which brings up another question: Can I just move the code from
    <pre>Private Sub Workbook_WindowActivate(ByVal Wn As Window)</pre>

    to
    <pre>Private Sub Workbook_Open()</pre>


    and from
    <pre>Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)</pre>

    to
    <pre>Private Sub Workbook_BeforeClose(Cancel As Boolean)</pre>


    without causing problems. I've attached my ThisWorbook object. I'm revisiting a project and trying to tweak it a little and perhaps remove the unneccessary in an attempt to speed it up. Any advice on simplifying and streamlining would be appreciated.
    Attached Files Attached Files
    - Ricky

  6. #6
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Screen Updating (Excel XP SR1)

    Yes, those events fire ever time you switch between workbooks.
    Legare Coleman

Posting Permissions

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