I'm trying to open an Excel File using a batchjob, but Windows isn't having it. I'm new at batchjobs so I'm largely cluess and have been trying to figure it out using oneline tips. However, I don't see what I'm doing differently than some of the examples that I've found.
Can anyone point out why this doesn't work to me?
@echo off
cls
start /d C:\Users\Admin\Gotti_Notes%20vENO0.3.xlsm
Also, since I'm asking, how can I set the exact time for this to run? Scheduled tasks in windows I assume. Correct?
I get no error message... it seems to run, but simply doesn't do anything.
The point of all of this is to open the file at a specified time (at night) and have excel automatically run a vba macro i wrote (which it would do using the "open" command).
UPDATE & SOLUTION:
@echo off
cls
call C:\Users\Admin\Notes.xlsm
echo on
I had to change the name in order for it to work.
I'm pretty sure you should be doing something like
C:\path\to\excel C:\Users\Admin\Gotti_Notes%20vENO0.3.xlsm
instead. As this SuperUser question notes, the command might look more like:
"C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE" "C:\Users\Admin\Gotti_Notes%20vENO0.3.xlsm"
Side note: according to this forum post, if running a macro is your eventual goal, you can pass in the name of the macro with the /m
flag. The poster says that this works with Word, but it might also work with Excel too.
Another side note: since you start the file with @echo off
, you probably want to reverse this at the end with echo on
; otherwise, after you run the script you won't have much of a prompt anymore.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加