Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ake Ake is offline
external usenet poster
 
Posts: 18
Default Print files in separate folders-please help


I have the following macro (i got from somewhere) that opens and prints the
excel files that i open in a common folder:

Public Sub PrintWorkbook()
Dim i As Integer
Dim FileNames As Variant
FileNames = Application.GetOpenFilename(, , "Choose workbooks", , True)
If IsArray(FileNames) Then
For i = 1 To UBound(FileNames)
Workbooks.Open FileNames(i)
ActiveWorkbook.ActiveSheet.PrintOut
ActiveWorkbook.Close (False)
Next i
End If
End Sub

What i want to do is open files that are located in different folders and
print them, what should i add to this program?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Print files in separate folders-please help


ake,

You can only select workbooks from one folder using the GetOpenFilename method, so you would either
need to run your macro once for each folder, or move all your files (or copies) into one folder.

HTH,
Bernie
MS Excel MVP


"ake" wrote in message
...
I have the following macro (i got from somewhere) that opens and prints the
excel files that i open in a common folder:

Public Sub PrintWorkbook()
Dim i As Integer
Dim FileNames As Variant
FileNames = Application.GetOpenFilename(, , "Choose workbooks", , True)
If IsArray(FileNames) Then
For i = 1 To UBound(FileNames)
Workbooks.Open FileNames(i)
ActiveWorkbook.ActiveSheet.PrintOut
ActiveWorkbook.Close (False)
Next i
End If
End Sub

What i want to do is open files that are located in different folders and
print them, what should i add to this program?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I update 2 or 3 duplicate workbooks in separate folders? LindaK Excel Discussion (Misc queries) 1 July 14th 09 04:02 AM
Need to Export All Worksheets from All Workbooks in Folder to Separate FIles not as CSV Files socrtwo Excel Programming 2 October 30th 06 12:46 AM
Open Separate Excel Files in Separate Windows JTWood Excel Discussion (Misc queries) 3 May 7th 06 10:18 PM
Files\folders in VBA funkymonkUK[_142_] Excel Programming 7 May 2nd 06 04:16 PM
Open Excel files in separate sessions, not just separate windows? Bob at Dexia Design Excel Discussion (Misc queries) 1 October 18th 05 05:46 PM


All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"