Results 1 to 7 of 7

Open Many Excel work books, (And more.....)

Threaded View

  1. #6
    Registered User
    Join Date
    05-14-2015
    Location
    Oldham, England
    MS-Off Ver
    2010
    Posts
    6

    Re: Open Many Excel work books, (And more.....)

    Hi

    On my computer - in devices and printer I can select a PDF creater as the default printer - so I don't know how it would work for those that don't have this option. I guess if anyone didn't have that it might print out to a normal printer? Works well for me this way as I have a set 'print area' that is on every page.

    here is the final code

    Option Explicit
    
    Sub ExtrData()
    Dim MyFolder As String  'Store the folder selected by the user
    Dim sFile As String  'The name of the file where data is selected for printing
    Dim wk As Workbook
    Dim pFile As String
    
    On Error Resume Next
    Application.ScreenUpdating = False
    
    'Display the folder picker dialog box for user selection of directory
    With Application.FileDialog(msoFileDialogFolderPicker)
        .Title = "Please select a folder"
        .Show
        .AllowMultiSelect = False
        If .SelectedItems.Count = 0 Then
            MsgBox "You did not select a folder"
            Exit Sub
        End If
        MyFolder = .SelectedItems(1) & "\"
    End With
    
    'Dir finds the files in the selected folder, to specify a specific filetype replace xlsx with proper file ending
    sFile = Dir(MyFolder & "*.xlsx")
    
    If sFile = "" Then
        MsgBox "No files matching set criteria found"
       Exit Sub
    End If
    
    Do While sFile <> ""
        Set wk = Workbooks.Open(MyFolder & sFile)
        Sheets("Register").Activate
      
    pFile = Mid(sFile, 1, Len(sFile) - 4)
        
       
    ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate _
            :=True, IgnorePrintAreas:=False
            
    Columns("E:R").Select
    Range("E3").Activate
     Selection.EntireColumn.Hidden = True
      
         wk.Close SaveChanges:=True
         
    sFile = Dir()
    
     Loop
     
     
    Application.ScreenUpdating = True
    
    End Sub
    Thanks again
    Last edited by Teebag180; 05-15-2015 at 05:04 AM.

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 share all open work books
    By ItzikM in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-25-2014, 08:56 PM
  2. [SOLVED] Print all open work books except the one running the macro??
    By james 35 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2013, 02:22 AM
  3. [SOLVED] Paste sheets into all open work books regardless on name ??
    By james 35 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2013, 08:18 AM
  4. need help to minimize the windows and allow other excel work books to open
    By Ignesh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-30-2012, 08:56 AM
  5. Not able to open or select other work books while user form is activate
    By rvc81 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-16-2011, 06:14 AM

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