Hi,

That code is great and it works but can you make like a function to tell the monitor power state.

I saw this code on the internet

Public Function IsMonitorOff() As Boolean

On Error GoTo Hell

Dim wmiObjSet As SWbemObjectSet
Dim colSettings As SWbemObject
wmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_DesktopMonitor")

For Each colSettings In wmiObjSet
MsgBox(colSettings.Availability)
Select Case colSettings.Availability
Case 7
IsMonitorOff = True
Case 3
IsMonitorOff = False
End Select
Next
Exit_For:
wmiObjSet = Nothing
On Error GoTo 0
Exit Function

Hell:
GoTo Exit_For
End Function

But the SWbemObjectSet and SWbemObject aren't decared and i can't find any on the internet.

JamesStewy