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
 

Becky

Webmistress
Joined
Mar 25, 2003
Messages
7,424
Reaction score
1,511
Looks like you had some unintended smilies in that post, I've sorted it for you now. Welcome to the forum! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top