Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Print multiple files withour opening

I use the following VBA code to print out all files in a folder in MS Word
instantly in the background without opening the documents. When I tried to
use it in MS Excel I received a message indicating that the Application
object in Excel doesn't support the PrintOut method. Is there a way to do
this in Excel? Thanks for any help.


With Application.FileSearch
..FileName = "*.*"
..LookIn = CurDir
If .Execute(msoFileFindSortbyFileName, _
SortOrder:=msoSortOrderAscending) 0 Then
For I = 1 To .FoundFiles.Count
Application.PrintOut FileName:= .FoundFiles(I)
Next I
End If
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Print multiple files withour opening

Hi

No, you must open them
Something like this will work

Sub Test()
Dim basebook As Workbook
Dim mybook As Workbook
Dim FNames As String
Dim MyPath As String
MyPath = CurDir
FNames = Dir("*.xls")
If Len(FNames) = 0 Then
MsgBox "No files in the Directory"
ChDrive SaveDriveDir
ChDir SaveDriveDir
Exit Sub
End If

Application.ScreenUpdating = False
Do While FNames < ""
Set mybook = Workbooks.Open(FNames)
mybook.PrintOut
mybook.Close False
FNames = Dir()
Loop
Application.ScreenUpdating = True
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl



"petecjr" wrote in message ...
I use the following VBA code to print out all files in a folder in MS Word
instantly in the background without opening the documents. When I tried to
use it in MS Excel I received a message indicating that the Application
object in Excel doesn't support the PrintOut method. Is there a way to do
this in Excel? Thanks for any help.


With Application.FileSearch
.FileName = "*.*"
.LookIn = CurDir
If .Execute(msoFileFindSortbyFileName, _
SortOrder:=msoSortOrderAscending) 0 Then
For I = 1 To .FoundFiles.Count
Application.PrintOut FileName:= .FoundFiles(I)
Next I
End If
End With



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
Opening multiple XLS files Mike Excel Discussion (Misc queries) 6 June 19th 08 08:20 PM
opening multiple files into one workbook, but multiple worksheets.... Andy Excel Discussion (Misc queries) 0 January 24th 07 06:34 PM
opening multiple .txt files from multiple folders Corben Excel Discussion (Misc queries) 3 March 16th 06 12:43 AM
How can I view files chronologically when opening multiple files Stevilsize Excel Discussion (Misc queries) 3 July 26th 05 12:49 AM
Opening multiple files Subhro Mukherjee via OfficeKB.com Links and Linking in Excel 1 June 22nd 05 11:43 PM


All times are GMT +1. The time now is 03:15 PM.

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"