Command Line to Open/Close an Excel Files , macro print it in a designated Folder

Joined
Apr 13, 2018
Messages
1
Reaction score
0
I have the following DOS command-line to schedule and macro & print a list of any files in a designated folder.
Can anyone advise how do I do for an excel file similar to the document ? I have tried but, it is only open but did not execute any macro.


ECHO OFF
set folder=%date:~10,4%%date:~4,2%%date:~7,2%
CLS
mkdir H:\daily\%folder%\%folder%temp
move H:\daily\%folder%\*.* H:\daily\%folder%\%folder%temp
for /f %%f in ('dir /b H:\daily\%folder%\%folder%temp') DO (
SET filename=%%f
CALL :pRINTXXX
)
GOTO :DELFOLDER
:DELFOLDER
timeout /T 10
rmdir /s /q H:\daily\%folder%\%folder%temp
GOTO :EOF
:pRINTXXX
"C:\Program Files\Microsoft Office\Office14\WINWORD.EXE" H:\daily\%folder%\%folder%temp\%filename% /q /n /mReFormatLayout /mFileCloseOrExit

:EOF
 
Looks like you had some unintended smilies in that post, I've sorted it for you now. Welcome to the forum! :)
 
Back
Top