ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need vb application to print first Worksheet in excel files (https://www.excelbanter.com/excel-programming/332402-need-vbulletin-application-print-first-worksheet-excel-files.html)

Nadia

Need vb application to print first Worksheet in excel files
 
Hi all and thanks in advance to anyone who helps me.

I have multiple excel workbooks containing 4-5 worksheets each. Each
workbook has a worksheet named "Summary" which summarizes calculations
performed on the other sheets.

I would like to design an application with a "browse" option so that I
select a folder or specific excel file and then click print so that it will
print only the summary page for the file.

This sounds possible...i apologize if i posted this in the wrong spot.

Any help is appreciated.

--
Nadia

Bernie Deitrick

Need vb application to print first Worksheet in excel files
 
Nadia,

The macro below should do what you want.

HTH,
Bernie
MS Excel MVP

Sub PrintSummaryForUserSelectedFiles()
Dim filearray As Variant
Dim i As Integer
filearray = Application.GetOpenFilename(MultiSelect:=True)
If IsArray(filearray) Then
For i = LBound(filearray) To UBound(filearray)
Workbooks.Open filearray(i)
Worksheets("Summary").PrintOut
ActiveWorkbook.Close False
Next i
Else:
MsgBox "You clicked cancel"
End If
End Sub



"Nadia" wrote in message
...
Hi all and thanks in advance to anyone who helps me.

I have multiple excel workbooks containing 4-5 worksheets each. Each
workbook has a worksheet named "Summary" which summarizes calculations
performed on the other sheets.

I would like to design an application with a "browse" option so that I
select a folder or specific excel file and then click print so that it

will
print only the summary page for the file.

This sounds possible...i apologize if i posted this in the wrong spot.

Any help is appreciated.

--
Nadia




Nadia

Need vb application to print first Worksheet in excel files
 
Thank you for your earlier post.

Should i create this macro within excel and just run it in there rather than
using vb.net to create an actual .exe application?
--
Nadia


"Bernie Deitrick" wrote:

Nadia,

The macro below should do what you want.

HTH,
Bernie
MS Excel MVP

Sub PrintSummaryForUserSelectedFiles()
Dim filearray As Variant
Dim i As Integer
filearray = Application.GetOpenFilename(MultiSelect:=True)
If IsArray(filearray) Then
For i = LBound(filearray) To UBound(filearray)
Workbooks.Open filearray(i)
Worksheets("Summary").PrintOut
ActiveWorkbook.Close False
Next i
Else:
MsgBox "You clicked cancel"
End If
End Sub



"Nadia" wrote in message
...
Hi all and thanks in advance to anyone who helps me.

I have multiple excel workbooks containing 4-5 worksheets each. Each
workbook has a worksheet named "Summary" which summarizes calculations
performed on the other sheets.

I would like to design an application with a "browse" option so that I
select a folder or specific excel file and then click print so that it

will
print only the summary page for the file.

This sounds possible...i apologize if i posted this in the wrong spot.

Any help is appreciated.

--
Nadia





Bernie Deitrick

Need vb application to print first Worksheet in excel files
 
Nadia,

Generally, since Excel will be used to open the workbooks anyway, it doesn't
really matter that much performance wise. If you put the code into a module
in a new workbook, then it will work fine. In vb.net, you would need to
change the code to use the Excel application object that you would start up
when the code started. I would go with the workbook approach, personally.

HTH,
Bernie
MS Excel MVP


"Nadia" wrote in message
...
Thank you for your earlier post.

Should i create this macro within excel and just run it in there rather

than
using vb.net to create an actual .exe application?
--
Nadia


"Bernie Deitrick" wrote:

Nadia,

The macro below should do what you want.

HTH,
Bernie
MS Excel MVP

Sub PrintSummaryForUserSelectedFiles()
Dim filearray As Variant
Dim i As Integer
filearray = Application.GetOpenFilename(MultiSelect:=True)
If IsArray(filearray) Then
For i = LBound(filearray) To UBound(filearray)
Workbooks.Open filearray(i)
Worksheets("Summary").PrintOut
ActiveWorkbook.Close False
Next i
Else:
MsgBox "You clicked cancel"
End If
End Sub



"Nadia" wrote in message
...
Hi all and thanks in advance to anyone who helps me.

I have multiple excel workbooks containing 4-5 worksheets each. Each
workbook has a worksheet named "Summary" which summarizes calculations
performed on the other sheets.

I would like to design an application with a "browse" option so that I
select a folder or specific excel file and then click print so that it

will
print only the summary page for the file.

This sounds possible...i apologize if i posted this in the wrong spot.

Any help is appreciated.

--
Nadia








All times are GMT +1. The time now is 11:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com