Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Opening multiple XLS files | Excel Discussion (Misc queries) | |||
opening multiple files into one workbook, but multiple worksheets.... | Excel Discussion (Misc queries) | |||
opening multiple .txt files from multiple folders | Excel Discussion (Misc queries) | |||
How can I view files chronologically when opening multiple files | Excel Discussion (Misc queries) | |||
Opening multiple files | Links and Linking in Excel |