英文:
[CLOCK TIMED ACTION]
问题
寻找一个能够在每天晚上9:00激活我创建的名为“IV”的函数的代码。我尝试过跟随其他脚本,但无法根据时间激活该函数。
英文:
Looking for a code to activate a function that i made called "IV" at 9:00 pm every day.
i tried following some other scripts but i can get it to activate the function using clock time.
答案1
得分: 0
I assume you're using windows. You could use a sleep function to control the process, but when you run macros you can't access your sheets in excel. VBA is not really set up for this type of thing so I propose another method.
Open up visual basic and put this in Thisworkbook:
Private Sub Woorbook_Open()
yourmacro.IV()
ThisWorkbook.Close()
End Sub
Where you just substitute the names of yourmacro
with the name of the macro file which contains your prodedure called IV
. This will run when the workbook is opened by the task scheduler, run the procedure, then close the workbook.
Then make a new task using windows task scheduler that opens this workbook at 9pm every night. (tutorial here: https://datacornering.com/how-to-run-excel-file-from-windows-10-task-scheduler/)
英文:
I assume you're using windows.
You could use a sleep function to control the process, but when you run macros you can't access your sheets in excel. VBA is not really set up for this type of thing so I propose another method.
Open up visual basic and put this in Thisworkbook:
Private Sub Woorbook_Open()
yourmacro.IV()
ThisWorkbook.Close()
End Sub
Where you just substitute the names of yourmacro
with the name of the macro file which contains your prodedure called IV
.
This will run when the workbook is opened by the task scheduler, run the procedure, then close the workbook.
Then make a new task using windows task scheduler that opens this workbook at 9pm every night. (tutorial here: https://datacornering.com/how-to-run-excel-file-from-windows-10-task-scheduler/)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论