Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Print the same sheet from different file

Hello every body.

I would like to ask if you have ever had a problem like this.

I have a folder which involve 200 sales reports, which all of them having
exactly the same format. The problem is that i want to get into the file and
give a print for sheet 2 from all files. I do not want to open it one by one.
it is to much 200 files and always miss, one.
There is any possibility to have a visual basic code to make this job? and
how can i work with it? I have seen something on the internet but i don not
how it works?
There is also the possibilit to create an add inn on the toolbars and give
from there the print command?

I am not so strong on visual basic and for that reason i would like as much
description of a solution, as it is possible.

Thanks in advance Manos
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Print the same sheet from different file

Hi Manos

Try this for all files in the folder C:\Data
It will print the second sheet of each file.

Copy the code in a normal module in a workbook that is
not in the folder C:\Data.

Open a new workbook
Alt-F11
InsertModule from the menu bar
paste the sub in there
Alt-Q to go back to Excel

If you do Alt-F8 you get a list of your macro's
Select "TestFile1" and press Run




Sub TestFile1()
Dim basebook As Workbook
Dim mybook As Workbook
Dim FNames As String
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir
MyPath = "C:\Data"
ChDrive MyPath
ChDir MyPath
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.Sheets(2).PrintOut
mybook.Close False
FNames = Dir()
Loop
ChDrive SaveDriveDir
ChDir SaveDriveDir
Application.ScreenUpdating = True
End Sub


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


"Manos" wrote in message ...
Hello every body.

I would like to ask if you have ever had a problem like this.

I have a folder which involve 200 sales reports, which all of them having
exactly the same format. The problem is that i want to get into the file and
give a print for sheet 2 from all files. I do not want to open it one by one.
it is to much 200 files and always miss, one.
There is any possibility to have a visual basic code to make this job? and
how can i work with it? I have seen something on the internet but i don not
how it works?
There is also the possibilit to create an add inn on the toolbars and give
from there the print command?

I am not so strong on visual basic and for that reason i would like as much
description of a solution, as it is possible.

Thanks in advance Manos



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
Auto PRINT file path & Date on Excel work sheet ? Harsh Excel Worksheet Functions 1 October 24th 08 04:18 PM
How do I print sheet , with actual file save date in footer? irfy Excel Worksheet Functions 6 June 26th 08 12:01 AM
In Excel, gridlines won't print--File,PageSetup,Sheet,Gridlines-- 4most New Users to Excel 3 July 9th 06 01:45 AM
How do I print from a file created from sending a print to a file Ted Johnston Excel Discussion (Misc queries) 1 February 23rd 06 03:10 AM
Active cell counting in particular print page (one sheet having different print area) ananthmca2004 Excel Worksheet Functions 1 November 24th 05 11:29 AM


All times are GMT +1. The time now is 03:38 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"