Give this one a go...
I got this one from
http://groups.google.com/group/micro...5283ecbd9e0c60
I still think either a reboot or a logoff/logon may be required for this to
take effect.
Option Explicit
Sub DisableScreenSaver()
Dim WShShell, Value, Saved
Dim Password
'Password=Inputbox ("Enter Password")
'If Password <> "running" then Wscript.quit
Set WShShell = CreateObject("WScript.Shell")
On Error Resume Next
Value = WShShell.RegRead("HKCU\Control Panel\Desktop\ScreenSaveActive")
Saved = WShShell.RegRead("HKCU\Control Panel\Desktop\SaveScreenSaved")
Err.Clear
'MsgBox Value & "-" & Saved
On Error GoTo 0
If Saved <> "1" Then
WShShell.RegWrite "HKCU\Control Panel\Desktop\SaveScreenSave", Value
WShShell.RegWrite "HKCU\Control Panel\Desktop\SaveScreenSaved", "1"
WShShell.RegWrite "HKCU\Control Panel\Desktop\ScreenSaveActive", "0"
End If
End Sub
Sub RestoreScreenSaver()
Dim WShShell, Value, Saved
Set WShShell = CreateObject("WScript.Shell")
On Error Resume Next
Value = WShShell.RegRead("HKCU\Control Panel\Desktop\SaveScreenSave")
Saved = WShShell.RegRead("HKCU\Control Panel\Desktop\SaveScreenSaved")
Err.Clear
'MsgBox Value & "-" & Saved
On Error GoTo 0
If Saved = "1" Then
WShShell.RegWrite "HKCU\Control Panel\Desktop\ScreenSaveActive",
Value
WShShell.RegWrite "HKCU\Control Panel\Desktop\SaveScreenSaved", "0"
End If
'WScript.Quit (0)
End Sub
Mark Ivey
"Andrew at Fleet" <(E-Mail Removed)> wrote in message
news:4E1BCE9F-6468-4899-AD82-(E-Mail Removed)...
> To whom it may concern,
>
> Is there a way to disable the Windows XP screen saver from an Excel macro?
> I'm using Excel 2003, and a "National Company" version of Windows XP where
> the control of the screensaver has been removed from the users. When I'm
> running an Excel macro over a large data file, the screensaver starts to
> activate. As the CPU's resources are being used by Excel at the time, the
> PC
> freezes. I'm wondering if there's some code that can be added to the
> macro
> to prevent that.
>
> --
> Andrew
> Telstra Fleet
> Melbourne
> Australia
>
> ----------------
> This post is a suggestion for Microsoft, and Microsoft responds to the
> suggestions with the most votes. To vote for this suggestion, click the "I
> Agree" button in the message pane. If you do not see the button, follow
> this
> link to open the suggestion in the Microsoft Web-based Newsreader and then
> click "I Agree" in the message pane.
>
> http://www.microsoft.com/communities...el.programming