问题
VBA for Office2007 seems to give the possibility to set system date and time with:
date = variable
and time = variable
however, if I try the code:
Dim Datum1
Datum1 = #12. Februar 1985#
Date = Datum1
I get the error message "Permission denied (Error 70)", which seems to indicate that I have no administrator rights, which is not the case.
Can anybody point me in the right direction?
回答1:
Use DateSerial and TimeSerial. For example:
Date = DateSerial(2015, 11, 4) 'For Date changing
Time = TimeSerial(12, 10, 22) 'For Time changing
...or you can try to use ShellExecute and Date.
来源:https://stackoverflow.com/questions/33600897/setting-system-date-and-time-using-vba