Results 1 to 10 of 10
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hide Code Execution (2000)

    How can I hide code execution? I want to avoid the changing screens and moving around on screen which may confuse some of my users.
    In Access I'd use the code:

    Application.echo = false

    but that doesn't seem to work in Excel
    I can't seem to find any hints in the help pages.

    Thanks again for your time.

  2. #2
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Code Execution (2000)

    OK, I discovered how to do it. For those who might be interested, the code is:

    Application.ScreenUpdating = False

    And then issue the 'True' command at the end of the code before 'end sub' or any instance of 'exit sub'.

    Thanks for looking.

  3. #3
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,829
    Thanks
    136
    Thanked 482 Times in 459 Posts

    Re: Hide Code Execution (2000)

    There are pros and cons with hiding screen activity.
    For long processes, with screen activity on, the User knows something is actually happening (albeit a bit distracting)
    With screen activity off, the User looks at the hourglass.
    For long processes, they may wonder if it is 'stuck'.

    For long processes, turning screen activity off will substantially speed up execution.
    So I generally turn screen activity off and 'sprinkle' a few notes in Excel's bottom statusbar to let the User know whats happening.

    For example:
    Application.StatusBar = "..processing input data"
    ...
    Application.StatusBar = "..preparing report"
    ...
    etc
    ..and then clearing and resetting the bottom statusbar when finished with
    Application.StatusBar = False
    (this resets the status bar to normal Excel operation)


    zeddy

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Hide Code Execution (2000)

    Hu Ted,

    There's an excellent demonstration of how to implement a progress indicator on Johm Walkenbach's site at http://j-walk.com/ss/excel/tips/tip34.htm

    You might also like to check my <post#=289117>post 289117</post#>, which used some fairly generic code for using the statusbar to indicate a macro's progress

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  5. #5
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Paragould, Arkansas, USA
    Posts
    194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Code Execution (2000)

    One way to avoid the look of "nothing happening" is to turn screen updating ON in appropriate places, then back OFF. The screen will change, the user will see some updating, but it won't be all that flash & scan of the macro operation.

    Errol

  6. #6
    5 Star Lounger Ruff_Hi's Avatar
    Join Date
    Feb 2001
    Location
    New York, New York, USA
    Posts
    768
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Code Execution (2000)

    Here is an example showing a progress form. I hate using the status bar because of all the store original, change, restore, etc and you can never actually see it.
    (Location Australia, then UK, but now USA. Heart, outlook, attitude, etc always Australian)
    Quote: "All Happiness is the release of internal pressure"

  7. #7
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Hide Code Execution (2000)

    Can I assume in your code:
    <pre> gfrmProgress.Show 0</pre>


    that the "0" is to make the form "modeless"?

    For anyone with XL97:
    This method will not work. Modeless forms are not available. If you eliminate the parameter, the code will not run "behind" the progressbar. You would have to close the form before it will continue (defeating the purpose of the progress bar).

    Steve

  8. #8
    5 Star Lounger Ruff_Hi's Avatar
    Join Date
    Feb 2001
    Location
    New York, New York, USA
    Posts
    768
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Code Execution (2000)

    Yeah '0' is modeless. Try the attached if you want one that works with XL97 and prior.
    (Location Australia, then UK, but now USA. Heart, outlook, attitude, etc always Australian)
    Quote: "All Happiness is the release of internal pressure"

  9. #9
    5 Star Lounger Ruff_Hi's Avatar
    Join Date
    Feb 2001
    Location
    New York, New York, USA
    Posts
    768
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide Code Execution (2000)

    And if you want to know what version of excel is running ...

    <pre>Select Case Application.Version
    Case "8.0", "8.0a", "8.0e" 'Excel 1997
    ...
    Case "9.0" 'Excel 2000
    ...
    Case "10.0" 'Excel 2002 - hopefully this will work!
    ...
    Case Else
    MsgBox "Error: Unknown Excel Version" & vbCrLf & _
    "Version: (" & Application.Version & ")."
    End Select</pre>

    (Location Australia, then UK, but now USA. Heart, outlook, attitude, etc always Australian)
    Quote: "All Happiness is the release of internal pressure"

  10. #10
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Hide Code Execution (2000)

    Thanks,
    Steve

Posting Permissions

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