locked
Batch files RRS feed

  • Question

  • Hi Guys,

    I've never strayed into the dark side before, but I think I have to use a macro to do the following:

    1. Open a Template in excel

    2. Input a text string from Document A (A separate document to the Template) 

    3. Save, print and close the document (I'm presuming I could just batch print them easily anyway without the use of excel)

    4. Open the template and the same as above, but using the text string data from the next row in Document A and so on..... 

    I could have the 2 documents as different tabs on the same workbook, as long as there is an easy way to then batch print them. 

    Any help would be appreciated, thank you!!!
    • Edited by JWLloyd Saturday, September 14, 2019 11:34 AM
    Saturday, September 14, 2019 11:33 AM

All replies

  • To:  JWLloyd,
    Re:  do something

    Some things to consider...

    What version of Excel are you using?
    Will you need to know how & where to use VBA code if it can be provided?

    re Question 1:  Is the template a xlt, xltx or a xltm file?  Is it protected?
    re Question 2:  Is 'Document A' an Excel file, Word file, text file or ?
    re Question 3:  "save and close the document" - do you mean the template?
    How do you identify the beginning row and ending row in "Document A"?
    Why not print each separate row from "Document A" and then copy all rows (at one time) to the "template"?
    (are there blank rows to be skipped?)
    Are there other tasks to be incorporated in the code?

    Following is VBA code to print each row from an Excel selection...
    '---
    Sub PrintEachRow()
    Dim rngPrint As Excel.Range
    Dim rngRow As Excel.Range
    Set rngPrint = Application.Intersect(Excel.Selection, ActiveSheet.UsedRange)

    If Not rngPrint Is Nothing Then
    For Each rngRow In rngPrint.Rows
    If Application.CountA(rngRow) > 0 Then
    rngRow.PrintOut copies:=1
    End If
    DoEvents
    Next
    End If

    Set rngPrint = Nothing
    End Sub
    '---


    Free add-ins and workbooks at MediaFire...
    http://www.mediafire.com/folder/lto3hbhyq0hcf/Documents

    Sunday, September 15, 2019 1:06 PM