You can run VBA macro through VBS file using task scheduler. Follow these steps
First create Sample.xlsm file and insert a macro named "Test" and put the message box in the macro
MsgBox "Hello World", 64
Then create the VBS file and name it "RunMe" with this code
Set fso = CreateObject("Scripting.FileSystemObject")
curDir = fso.GetAbsolutePathName(".")
Set myxlApplication = CreateObject("Excel.Application")
myxlApplication.Visible = False
Set myWorkBook = myxlApplication.Workbooks.Open( "C:\Users\Future\Desktop\Sample.xlsm" )
Don't forget to change the workbook path in the code
Follow the steps in the tutorial folder
The VBS file format was developed by Microsoft Corporation as an executable file format. These VBS files are also known as Visual Basic script files, and are affixed with the .vbs file extension. These VBS files are classified as source code and program files for Windows PCs.
A .vbs file contains lines of codes in the Visual Basic programming language and may be associated with other programs. These VBS files are encoded in plain text format. It's advised to be careful when opening VBS files, especially when these .vbs files are sent as email attachments by unknown sources.
These VBS files can be opened as executable files in a Windows PC. Standard text editing applications like Notepad can also be used to view and edit the content of these .vbs files. A VBS file can also be opened and edited using Microsoft Visual Studio.
You can create simple text file and when saving add the extension .vbs to the file name