+ Reply to Thread
Results 1 to 6 of 6

Request VBA Macro - Using DOS Command - Reposting

  1. #1
    Registered User
    Join Date
    02-07-2012
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    54

    Request VBA Macro - Using DOS Command - Reposting

    Hi All

    It would be a great when I get this VBA macro for below manual process.

    I am using dos command to rearrange pdf page order. Please see below is our manual process for reordering pdf pages.

    1. Using Excel, we are entering page from, to and image type.
    2. Sorting image type as alphabetical order.
    3. Manually replace the “from – to” in single cell, see attached image for reference.
    4. I placed the pdf file in pdftk.exe folder
    5. In Excel manually prepared command line placed in Com.exe

    Please refer the attached screen shot and original pdf file and re order pdf file for your reference.

    3-7-2014 8-14-21 PM.png
    Attachment 302652REORDER.pdfImgtype.pdf
    Last edited by ganeshinscribe; 03-08-2014 at 02:52 AM.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Request VBA Macro - Using DOS Command - Reposting

    Hi,

    I want to thank you for introducing me to the PDF Tool Kit. It appears to be very powerful and very fast.

    Try the attached file which does the following:
    a. Deletes output file 'Reorder.pdf' if it exists.
    b. Sorts the data by Image Type (Column D)
    c. Creates a .bat file to run 'pdftk.exe'.
    d. Runs the .bat file to create an output .pdf file.
    e. Optionally deleted\s file 'Scratch00.bat'.
    f. Opens the output .pdf file (Reorder.pdf)

    NOTES:
    1. It is assumed that all files are in the folder that contains the attached Excel file.
    2. File 'Pdftk.exe' must be in an accessible path. NOTE: I had problems running it from a path that contained embedded spaces.
    If 'Pdftk.exe' is NOT ACCESSIBLE, it is suggested to put a copy in the folder that contains this file.
    3. The program times out if the output file 'Reorder.pdf' has not been created in 5 seconds.
    4. The program uses scratch files 'Scratch00.bat' and 'Scratch01.txt'

    If it appears that 'pdftk.exe' does not run, you may be able to modify the constant 'sPathAndPdftkDotExeNAME' at the top of Module 'ModAutomatePdftk' to become something like: 'c:\pdftk\pdftk.exe'.

    Lewis
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    02-07-2012
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    54

    Re: Request VBA Macro - Using DOS Command - Reposting

    Hi Lewis,

    Really wondering this reply

    I have one update on this program.

    I am processing more than 25 files per day and we need to copy the exe file in each files folder to reorder.

    So kindly change the exe file path is constant i.e. it will update Excel cell itself. (K4, H5)

    Please help to do this request.

    Thanks in advance.

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Request VBA Macro - Using DOS Command - Reposting

    Hi,

    Try the attached file. I think it does what you want. It allows you to select:
    a. The location of 'pdftk.exe' (only has to be done once).
    b. The location (folder) that contains the data files (only has to be done when the location changes).
    c. It assumes that file 'Imgtype.pdf' is always the name of the input pdf file.

    Please let me know if you need any additional changes.

    Lewis
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-12-2024
    Location
    India
    MS-Off Ver
    Office 2019
    Posts
    6

    Re: Request VBA Macro - Using DOS Command - Reposting

    Hi All,

    Currently using Office 2019, and got Compile Error, and request experts opinion for above scripts.


    Attachment 866809

    I appreciate if anyone help in this matter.

    Thank you
    G

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Request VBA Macro - Using DOS Command - Reposting

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #1 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Button command doesnt work while calling a macro from a macro
    By bryan444 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2012, 09:39 AM
  2. Macro command
    By bur in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2012, 03:37 PM
  3. Using macro to execute a command in Shell Command
    By aadarsh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-19-2010, 07:06 PM
  4. Replies: 0
    Last Post: 08-26-2010, 11:49 AM
  5. Use Macro To Change Macro Assigned To Command Button
    By CVinje in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2010, 07:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1