Script to prevent PC from sleeping

jordanburch

Active Member
Joined
Jun 10, 2016
Messages
443
Office Version
  1. 2016
Hi I'm looking for a script that will prevent my laptop from sleeping and keep teams active. I also need instructions on how to install. Can anyone help me please?
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi I'm looking for a script that will prevent my laptop from sleeping and keep teams active. I also need instructions on how to install. Can anyone help me please?
I think you can simply go to settings on your PC (Not Excel) and set your PC to Never instead of a time
 
Upvote 0
I typically use something like this to keep the presence indicator active and the computer awake. Paste this into a module.
VBA Code:
Private NextTime As Date

Sub KeepAlive()
ActiveSheet.Range("A1").Select

Application.Wait DateAdd("s", 1, Now)
NextTime = DateAdd("s", 30, Now)

SendKeys ("{enter}")

Application.OnTime NextTime, "KeepAlive"

End Sub
Sub StopKeepAlive()
On Error Resume Next

Application.OnTime NextTime, "KeepAlive", , False
End Sub

Run 'KeepAlive' to start it. Important: after running the script, select a cell in your worksheet. Any cell will be fine.
To stop it, run 'StopKeepAlive'.
 
Upvote 0
Use a powerpoint slide show which is never ending.
 
Upvote 0
I typically use something like this to keep the presence indicator active and the computer awake. Paste this into a module.
VBA Code:
Private NextTime As Date

Sub KeepAlive()
ActiveSheet.Range("A1").Select

Application.Wait DateAdd("s", 1, Now)
NextTime = DateAdd("s", 30, Now)

SendKeys ("{enter}")

Application.OnTime NextTime, "KeepAlive"

End Sub
Sub StopKeepAlive()
On Error Resume Next

Application.OnTime NextTime, "KeepAlive", , False
End Sub

Run 'KeepAlive' to start it. Important: after running the script, select a cell in your worksheet. Any cell will be fine.
To stop it, run 'StopKeepAlive'.
awesome thanks
 
Upvote 0

Forum statistics

Threads
1,223,927
Messages
6,175,437
Members
452,641
Latest member
Arcaila

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top