Consulting

Results 1 to 4 of 4

Thread: More Info on Program "XLAppRest"

  1. #1

    More Info on Program "XLAppRest"

    A couple of you fine folks have referred to the program that is named either "XLAppRest" or "XLAppReset" that is presumably associated with resetting all the statements like "Application.Calculation" to their default values. Sorry to say I haven't heard of it before now. Where can I find more info on it?

  2. #2
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    Hey Sid,

    It's actually a custom built subroutine used to restore the default states of your environment before you ran your code. Every coder would use most of the same items, but some may omit a few as they don't use certain pieces...

    I call my own something different, but you'll get the idea here. In mine, I call Environ_SpeedBooster at the beginning of each major subroutine, and then Environ_RestoreSettings at the end, or after an error forces an exit.

    These have been cut directly from one of my projects...

    Public xlCalcState As Long
    
    Sub Environ_SpeedBooster()
    'Macro created 06/11/2005 22:29 by Ken Puls
    'Macro Purpose:  To set application properties to maximize speed
    xlCalcState = Application.Calculation
    With Application
            .ScreenUpdating = False
            .Calculation = xlCalculationManual
        End With
    End Sub
    
    Sub Environ_RestoreSettings()
    'Macro created 06/11/2005 22:33 by Ken Puls
    'Macro Purpose: To restore application properties to user settings
    With Application
            .ScreenUpdating = True
            .Calculation = xlCalcState
            .EnableEvents = True
            .DisplayAlerts = True
            .StatusBar = False
        End With
    xlCalcState = 0
    End Sub
    HTH,
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





  3. #3
    Hey, Ken, that's exactly what I wanted to know. I guess I do the same thing functionally (I write each reset statement), I just never thought to gather it together into one utility macro and call it from my procedure. Duh! I thought that maybe there was an "official" utility that sits in the dark and misty recesses of Excel somewhere. I can write one of those ... and I will!!
    Thanx for the reply and code.

  4. #4
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    Hey Sid!

    No problems at all. The nice thing about this format is that if you do step through your code and stop the execution before your reset runs, you just have to run that procedure and you're good. Add it to a shortcut key, and you can do it very quickly from the Excel interface if necessary as well.

    For my own purposes, when I'm building an addin, I don't always put in all those pieces in the restore part. For example, if I don't ever disable events or alerts, I'll skip

    .EnableEvents = True
            .DisplayAlerts = True
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





Posting Permissions

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