+ Reply to Thread
Results 1 to 4 of 4

i need a macro to pull excel files from a folder and print them

  1. #1
    Registered User
    Join Date
    05-04-2013
    Location
    Florida, United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    i need a macro to pull excel files from a folder and print them

    I save my files in a folder called poreq the file names are set like this po-xxx-xxxx-5-6-13 these last 3 sets of numbers are the date I need to be able to pull up all the files with in a start and stop date and print them can anyone help
    I have no idea how to start this

  2. #2
    Forum Contributor
    Join Date
    12-31-2012
    Location
    Jhang, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: i need a macro to pull excel files from a folder and print them

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-04-2013
    Location
    Florida, United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: i need a macro to pull excel files from a folder and print them

    I couldn't get this to work but I probably messed up on setting the dir it should be
    D:\new sws folder\maintenance\poreq
    also it looks like this will only check for the date in the macro how would you put a input statement so it asks what date you want
    Thanks for the help I am totally lost

  4. #4
    Registered User
    Join Date
    05-04-2013
    Location
    Florida, United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: i need a macro to pull excel files from a folder and print them

    I got it

    Sub Batch_Print()
    '
    'Sub Batch_Print()
    Dim Input_Dir, Print_File As String
    Input_Dir = InputBox _
    ("Input directory path containing the files to print")
    ' Defines Print_File equal to the first Microsoft Excel file found
    ' in the directory specified in the InputBox above.
    Print_File = Dir("D:\new sws folder\maintenance\poreq\*" & Input_Dir & "*.xl*")


    ' Loops through the directory specified in the above InputBox
    ' and opens each workbook in the directory, prints all sheets
    ' in the workbook and closes the workbook. Continues until are
    ' all files are printed.
    Do While Len(Print_File) > 0
    Workbooks.Open Filename:="D:\new sws folder\maintenance\poreq\" & Print_File
    ActiveWorkbook.Printout Copies:=1
    ActiveWorkbook.Close
    Print_File = Dir()
    Loop
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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