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

Discussion in 'General Discussion' started by Toh Chai Hou, Apr 13, 2018.

  1. Toh Chai Hou

    Toh Chai Hou

    Joined:
    Apr 13, 2018
    Likes Received:
    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
     
    Toh Chai Hou, Apr 13, 2018
    #1
    1. Advertisements

  2. Toh Chai Hou

    Becky Webmistress Administrator

    Joined:
    Mar 25, 2003
    Likes Received:
    1,130
    Location:
    Manchester
    Looks like you had some unintended smilies in that post, I've sorted it for you now. Welcome to the forum! :)
     
    Becky, Apr 13, 2018
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.