Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Application.ScreenUpdating

Hi,
I'm using XL2007SP2 on WinXP and I'm having problems with the
following code:

Sub Turn_Off()
With Application
.EnableEvents = False
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
End Sub

When I run it, the screen updating stays set to true, while the other
two commands change condition. Can anyone tell what I need to do to
fix it?
Thanks.
James
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Application.ScreenUpdating

After serious thinking John Smith wrote :
Hi,
I'm using XL2007SP2 on WinXP and I'm having problems with the
following code:

Sub Turn_Off()
With Application
.EnableEvents = False
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
End Sub

When I run it, the screen updating stays set to true, while the other
two commands change condition. Can anyone tell what I need to do to
fix it?
Thanks.
James


ScreenUpdating is not persistent and so automatically turns back on
when your procedure ends. It only works while the procedure runs!

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Application.ScreenUpdating

When you run code from the VBE that is what you get.
Close the VBE and run the code and see if it kicks in.
'---
An extra... make sure that .EnableEvents is set back to true before exiting your code.
That includes setting it to true in your error handler.
'---
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(free and commercial excel programs)



"John Smith"
wrote in message
...
Hi,
I'm using XL2007SP2 on WinXP and I'm having problems with the
following code:

Sub Turn_Off()
With Application
.EnableEvents = False
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
End Sub

When I run it, the screen updating stays set to true, while the other
two commands change condition. Can anyone tell what I need to do to
fix it?
Thanks.
James



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Application.ScreenUpdating

On Feb 23, 4:12*pm, "Jim Cone" wrote:
When you run code from the VBE that is what you get.
Close the VBE and run the code and see if it kicks in.
'---
An extra... make sure that .EnableEvents is set back to true before exiting your code.
That includes setting it to true in your error handler.
'---
Jim Cone
Portland, Oregon USAhttp://www.mediafire.com/PrimitiveSoftware
(free and commercial excel programs)

"John Smith"
wrote in ...



Hi,
I'm using XL2007SP2 on WinXP and I'm having problems with the
following code:


Sub Turn_Off()
With Application
* *.EnableEvents = False
* *.ScreenUpdating = False
* *.Calculation = xlCalculationManual
End With
End Sub


When I run it, the screen updating stays set to true, while the other
two commands change condition. Can anyone tell what I need to do to
fix it?
Thanks.
James- Hide quoted text -


- Show quoted text -


Thank you, gentlemen. You have set me straight. Yes, Jim, I have a
similar module that resets everything after the procedure.
James
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Application.ScreenUpdating

John Smith used his keyboard to write :
On Feb 23, 4:12*pm, "Jim Cone" wrote:
When you run code from the VBE that is what you get.
Close the VBE and run the code and see if it kicks in.
'---
An extra... make sure that .EnableEvents is set back to true before exiting
your code. That includes setting it to true in your error handler.
'---
Jim Cone
Portland, Oregon USAhttp://www.mediafire.com/PrimitiveSoftware
(free and commercial excel programs)

"John Smith"
wrote in
...



Hi,
I'm using XL2007SP2 on WinXP and I'm having problems with the
following code:


Sub Turn_Off()
With Application
* *.EnableEvents = False
* *.ScreenUpdating = False
* *.Calculation = xlCalculationManual
End With
End Sub


When I run it, the screen updating stays set to true, while the other
two commands change condition. Can anyone tell what I need to do to
fix it?
Thanks.
James- Hide quoted text -


- Show quoted text -


Thank you, gentlemen. You have set me straight. Yes, Jim, I have a
similar module that resets everything after the procedure.
James


This should be handled in the same procedure so your caller (procedure
using it) can control how it gets reset. Here's how I do it...

Public Sub EnableFastCode(Optional SetFast As Boolean = True, _
Optional EventsEnabled As Boolean = False, _
Optional CalcMode As Long = xlCalculationManual)
With Application
.EnableEvents = EventsEnabled
.Calculation = CalcMode
.ScreenUpdating = Not SetFast
End With 'Application
End Sub 'EnableFastCode

To use it...

Sub DoStuff()
Dim bEventsEnabled As Boolean, lCalcMode As Long

'Store existing setting
With Application
bEventsEnabled = .EnableEvents: lCalcMode = .Calculation
End With 'Application

EnableFastCode '..turns everything off
'..code to do stuff
'..code to do stuff
'..code to do stuff

'..code to do stuff
'..code to do stuff

'..code to do stuff
'..code to do stuff
'..code to do stuff

'..code to do stuff
'..code to do stuff

'..code to do stuff
'..code to do stuff
'..code to do stuff

'..code to do stuff
'..code to do stuff
EnableFastCode False, bEventsEnabled, lCalcMode
End Sub 'DoStuff

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Application.ScreenUpdating

On Feb 23, 5:32*pm, GS wrote:
John Smith used his keyboard to write :





On Feb 23, 4:12*pm, "Jim Cone" wrote:
When you run code from the VBE that is what you get.
Close the VBE and run the code and see if it kicks in.
'---
An extra... make sure that .EnableEvents is set back to true before exiting
your code. That includes setting it to true in your error handler.
'---
Jim Cone
Portland, Oregon USAhttp://www.mediafire.com/PrimitiveSoftware
(free and commercial excel programs)


"John Smith"
wrote in
...


Hi,
I'm using XL2007SP2 on WinXP and I'm having problems with the
following code:


Sub Turn_Off()
With Application
* *.EnableEvents = False
* *.ScreenUpdating = False
* *.Calculation = xlCalculationManual
End With
End Sub


When I run it, the screen updating stays set to true, while the other
two commands change condition. Can anyone tell what I need to do to
fix it?
Thanks.
James- Hide quoted text -


- Show quoted text -


Thank you, gentlemen. You have set me straight. Yes, Jim, I have a
similar module that resets everything after the procedure.
James


This should be handled in the same procedure so your caller (procedure
using it) can control how it gets reset. Here's how I do it...

Public Sub EnableFastCode(Optional SetFast As Boolean = True, _
* * * * * * * * * * *Optional EventsEnabled As Boolean = False, _
* * * * * * * * * * *Optional CalcMode As Long = xlCalculationManual)
* With Application
* * .EnableEvents = EventsEnabled
* * .Calculation = CalcMode
* * .ScreenUpdating = Not SetFast
* End With 'Application
End Sub 'EnableFastCode

To use it...

Sub DoStuff()
* Dim bEventsEnabled As Boolean, lCalcMode As Long

* 'Store existing setting
* With Application
* * bEventsEnabled = .EnableEvents: lCalcMode = .Calculation
* End With 'Application

* EnableFastCode '..turns everything off
* '..code to do stuff
* '..code to do stuff
* '..code to do stuff

* '..code to do stuff
* '..code to do stuff

* '..code to do stuff
* '..code to do stuff
* '..code to do stuff

* '..code to do stuff
* '..code to do stuff

* '..code to do stuff
* '..code to do stuff
* '..code to do stuff

* '..code to do stuff
* '..code to do stuff
* EnableFastCode False, bEventsEnabled, lCalcMode
End Sub 'DoStuff

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup!
* * comp.lang.basic.visual.misc
* * microsoft.public.vb.general.discussion- Hide quoted text -

- Show quoted text -


Thanks, Garry. I'll give a try.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.ScreenUpdating Scott Excel Programming 3 October 25th 09 03:09 AM
Application.ScreenUpdating Barb Reinhardt Excel Programming 2 August 1st 08 07:17 PM
How to set Application.ScreenUpdating = False for Gen use David_Williams_PG () Excel Discussion (Misc queries) 1 August 15th 06 12:06 PM
application screenupdating issue Gary Keramidas Excel Programming 4 March 11th 06 02:45 AM
PLEASE PLEASE HELP Application.Screenupdating modjoe23[_6_] Excel Programming 3 September 3rd 05 05:08 AM


All times are GMT +1. The time now is 03:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"