I want to set system time with vba code using win apis
I use this code:
time remain same in win7
lreturn value is 0
i try to do that with
Time = TimeValue("00:00:00")
i got error permission denied
win 7 seems not alows changing systemtime or...
I use this code:
Code:
Option Compare Database
Option Explicit
Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Public Function newtime()
Dim lReturn As Long
Dim lpSystemTime As SYSTEMTIME
lpSystemTime.wYear = 2000
lpSystemTime.wMonth = 1
lpSystemTime.wDayOfWeek = -1
lpSystemTime.wDay = 24
lpSystemTime.wHour = 23
lpSystemTime.wMinute = 26
lpSystemTime.wSecond = 0
lpSystemTime.wMilliseconds = 0
lReturn = SetSystemTime(lpSystemTime)
Debug.Print lReturn
exit function
lreturn value is 0
i try to do that with
Time = TimeValue("00:00:00")
i got error permission denied
win 7 seems not alows changing systemtime or...
Last edited: