David Montoya
New Member
- Joined
- Apr 25, 2018
- Messages
- 49
Dear, I would like to have a macro running automatically on a daily basis (if workbook is opened), on assigned schedule, and based on the environment user name.
I have come up to the following code, but it does not work, and need your assistance to perfected:
Thanks in advance for your valuable assistance.
I have come up to the following code, but it does not work, and need your assistance to perfected:
Code:
Sub RunSchedule()
If Environ$("username") = "user1" Then
Aplication.OnTime TimeValue("16:40:00"), "macroname"
ElseIf Environ$("username") = "user2" Then
Aplication.OnTime TimeValue("16:45:00"), "macroname"
ElseIf Environ$("username") = "user3" Then
Aplication.OnTime TimeValue("16:50:00"), "macroname"
End If
End Sub
Thanks in advance for your valuable assistance.