+ Reply to Thread
Results 1 to 5 of 5

Automate Print to pdf with a loop getting info from cells

  1. #1
    Registered User
    Join Date
    03-11-2021
    Location
    Lisbon
    MS-Off Ver
    365
    Posts
    13

    Post Automate Print to pdf with a loop getting info from cells

    Hey all

    So i always use a macro to Cut and zip some files with password, but now instead of 10 files they will be 120!

    How can i put this code in a loop and get the info from cells?


    Please Login or Register  to view this content.
    Tx in advance!
    Last edited by davesexcel; 03-11-2021 at 06:22 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-30-2018
    Location
    Vlaams Brabant Belgium
    MS-Off Ver
    365
    Posts
    456

    Re: Automate Print to pdf with a loop getting info from cells

    Hi,

    We will need more information.
    the code goes to only 1 sheet
    do you have a workbook with 120 sheets?
    and what information do you want from what cells
    Please be as complete as possible in your asking so it may save use all the time to rework the solution because you didn't give all the requirements. If you have a layout in mind please work it out first so we can adapt our solution to it. Thanks.
    If you have been helped, maybe you could click the *

  3. #3
    Registered User
    Join Date
    03-11-2021
    Location
    Lisbon
    MS-Off Ver
    365
    Posts
    13

    Re: Automate Print to pdf with a loop getting info from cells

    Hey Joske920,

    i have 1 sheet for each file, so i have 120 sheets.

    Sheets("Sheet1").Select -> get on cell A2
    Filename:= _ "C:\Saves\File1.pdf"-> get on cell B2

    Sheets("Sheet1").Select
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    "C:\Saves\File1.pdf", Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
    False


    strSourceFileName is the same as above but in .zip -> get on cell C2
    strDestFileName is the same as above -> get on cell B2
    strPassword -> get on cell D2

    strDestFileName = "C:\Saves\Detalhe.zip"
    strSourceFileName = "C:\Saves\Detalhe.pdf"
    str7ZipPath = "C:\Program Files\7-Zip\7z.exe"
    strPassword = "Pass"

    strCommand = str7ZipPath & " -p" & strPassword & " a -tzip """ & strDestFileName & """ """ & strSourceFileName & """"
    Shell strCommand


    Tx!

  4. #4
    Valued Forum Contributor
    Join Date
    09-30-2018
    Location
    Vlaams Brabant Belgium
    MS-Off Ver
    365
    Posts
    456

    Re: Automate Print to pdf with a loop getting info from cells

    Hi,

    Give this a try
    Put it in a module

    Please Login or Register  to view this content.
    in case you want to add a page with a button to run this subroutine you need to remove the ' infront then comment lines and change the name extrasheet to the name of that 'menu' sheet
    Attached Files Attached Files
    Last edited by Joske920; 03-11-2021 at 03:20 PM.

  5. #5
    Registered User
    Join Date
    03-11-2021
    Location
    Lisbon
    MS-Off Ver
    365
    Posts
    13

    Re: Automate Print to pdf with a loop getting info from cells

    Hey Joske920,

    Worked great!

    Thanks alot!!!

+ 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. [SOLVED] Macro to index a cell and loop a print function on conditions certain cells contain a
    By ShamanWolf in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-18-2019, 03:27 PM
  2. Automate extraction of contact list info from web pages
    By durveamo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-27-2018, 08:05 AM
  3. ExecWB to print webpages to PDF - automate print file filename
    By Kevin_N_PA in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2016, 07:42 PM
  4. Automate lOOP
    By vradhak7 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-31-2014, 05:51 PM
  5. Automate Info Population from another sheet
    By Flyinace2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2013, 05:43 AM
  6. [SOLVED] Automate and Print Reports through VBA
    By waleed# in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2013, 07:46 AM
  7. [SOLVED] userForm loop that returns info back into cells (with some cells not included)
    By Sleepyshy in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-13-2012, 12:04 PM

Tags for this Thread

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