scottleger4
New Member
- Joined
- Oct 3, 2016
- Messages
- 41
- Office Version
- 365
- Platform
- Windows
Good morning. I'm at a bit of a loss as to what's happening, hopefully you guys can help.
I have a large data query that I run every day, usually takes about an hour or so to run. I'm trying to setup an "auto run" using task manager. Task manager will open a different file (SC auto run) with a private sub to run my macro upon opening the workbook.
Those individual macros are as follows, stored in the main file (not the auto run file).
The auto run file opens on time properly (task scheduler works), the first macro (OpenMEGA) executes properly, but then after some time I get the run time error 1004 in the subject line. I hit debug and it brings me to the second line in my "UpdateMega" macro. Can't figure out why, the syntax works in other workbooks, the names match, and I know the macro itself is good as I can successfully run ad-hoc. Just at the end of my understanding/troubleshooting. Thanks in advance.
I have a large data query that I run every day, usually takes about an hour or so to run. I'm trying to setup an "auto run" using task manager. Task manager will open a different file (SC auto run) with a private sub to run my macro upon opening the workbook.
Code:
Private Sub Workbook_Open()
OpenMEGA
UpdateMega
End Sub
Code:
Sub OpenMEGA()
Workbooks.Open Filename:= _
"O:\OPS\Wdrive\public\#RM Reports\YMTD data dump\MEGA Files\YMTD weekly & month w trends chnl dwe car w book week SC.xlsm" _
, UpdateLinks:=0
End Sub
Sub UpdateMega()
Windows("YMTD weekly & month w trends chnl dwe car w book week SC.xlsm").Activate
Application.Run "'YMTD weekly & month w trends chnl dwe car w book week SC.xlsm'!Macro1"
End Sub
Last edited by a moderator: