Results 1 to 2 of 2

Thread: Open, insert data , rename, save and print batch
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jun 2019
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Open, insert data , rename, save and print batch

    Hi Guru's/Geniuses,

    I have a template which uses VLookup to get data from a master spreadsheet. All of the lookup data is from a list of code numbers on the master spreadsheet.
    I need to be able to:

    1. Open the template
    2. Insert the code number
    3. Save the file as the code number (plus possibly another generic text string, for example "Reference number T34876"
    4. Print the document (Although I can batch this if necessary separately)
    5. Re-open the template and start the process again with the next code number on the spreadsheet.

    I have a few hundred to do so am looking for a Batch solution, but haven't used any kind of VBA/Macro in the past. So any advice or ideas would be appreciated.

    Hope That all makes sense, thanks in advance!!!

  2. #2
    Board Regular sergioMabres's Avatar
    Join Date
    Feb 2013
    Location
    Córdoba, Argentina
    Posts
    946
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Open, insert data , rename, save and print batch

    Hi Jake,
    Run this after you enter your code number
    Code:
    Sub RunAfterEnterCodeNumber()
    '
    ' Run this after you enter the code number in B2
    '
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
        ActiveWorkbook.SaveAs Filename:= _
            "C:\Users\...\Code-" & Range("b2").Value & ".xlsm" _
            , FileFormat:=xlOpenXMLWorB2kbookMacroEnabled, CreateBackup:=False
        Workbooks.Open Filename:="C:\Users\...Template.xlsm"
    End Sub
    I do not know where you template is so I use3 C:\Users\...\, change it with your real value
    I do not know where the code mumbrer is so I use B2, change it with your real value
    Cheers
    Sergio

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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