Good Afternoon. I am currently very novice a VBA and am trying to create a simple code that will open a workbook, flip to a specific worksheet (Transaction Analysis) and run two macros. Then is should flip to worksheet "Fund Trend" and run those same two macros, then save and close. I found this code online and have slightly modified to try to open a specific sheet within the workbook with no luck.
If I exclude the line regarding "ActiveWorkbook.Sheets("Transaction Analysis") then the script works correctly for the open worksheet. It is when I try to add anything referencing a specific worksheet within the workbook that I run into issues. The the script shown below, the workbook opens and that's it. The script stops there and does not run the macros.
I would really appreciate any help or suggestions! The idea is to schedule schedule the execution of the final vbscript with task scheduler. Thank You!
Dim args, objExcel
Set args = wscript.Arguments
set objExcel = CreateObject("Excel.Application")
objExcel.workbooks.open args(0)
objExcel.Visible = True
ActiveWorkbook.Sheets("Transaction Analysis")
objExcel.Run "Clear"
objExcel.Run "SecurityDistribution"
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close(0)
objExcel.Quit