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

This might be a little far fetched but I would like to
know how if it is possible to make my VBA program disable
the windows screensaver at the beginning of execution and
then enable it at the end. The reason is that the program
seems to error out when the screensaver comes on.

Jeff
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Disabling Screensaver

This nice little API function from Don Bradner seems to do the trick:

Private Declare Function SystemParametersInfo Lib "user32" Alias _
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _
lpvParam As Any, ByVal fuWinIni As Long) As Long

Sub SetScreenSaver(OnOff As Long)
'From Don Bradner
Dim templong As Long
Const SPI_SETSCREENSAVEACTIVE = 17
Const SPIF_UPDATEINIFILE = 1
Const SPIF_SENDWININICHANGE = 2
templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal
0&, _
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub

Sub MySub()
SetScreenSaver 0
'your code here
SetScreenSaver 1
End Sub

--

Vasant


"Jeff Armstrong" wrote in message
...
This might be a little far fetched but I would like to
know how if it is possible to make my VBA program disable
the windows screensaver at the beginning of execution and
then enable it at the end. The reason is that the program
seems to error out when the screensaver comes on.

Jeff



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
Disabling the cut function? Tim G. Excel Discussion (Misc queries) 3 September 27th 06 05:01 PM
Can I display an Excel chart as my screensaver display? Burke Charts and Charting in Excel 0 August 1st 06 07:01 PM
Problem with VB on screensaver Nigel Excel Discussion (Misc queries) 0 June 6th 05 11:37 AM
Macro run slow when turn on ScreenSaver Bill Li Excel Programming 0 October 30th 03 03:28 AM
Auto_Open disabling Tritan Excel Programming 6 July 22nd 03 11:48 AM


All times are GMT +1. The time now is 07:04 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"