Manikanta9333
New Member
Hello,
I have implemented a macro in vba that refreshes the data from a database and scheduled it using the windows task scheduler. I have attached the vbs code for reference:
>>> use code - tags <<<
Windows task scheduler closes other opened excel tabs after the macro execution. I tried executing on other systems also. Sometimes it's working (doesn't close all excels) sometimes it doesn't.
Please help me resolve this issue.
I have implemented a macro in vba that refreshes the data from a database and scheduled it using the windows task scheduler. I have attached the vbs code for reference:
>>> use code - tags <<<
Code:
ExcelFilePath = "C:\Users\hp\Desktop\TEST\test.xlsm" ' File path
MacroPath = "test" ' Macro name
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Visible = True 'or "False"
Set wb = ExcelApp.Workbooks.Open(ExcelFilePath)
ExcelApp.Run MacroPath
wb.Save
wb.Close
ExcelApp.Quit
Please help me resolve this issue.
Last edited by a moderator: