ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba routine to print a list of documents/worksheets (https://www.excelbanter.com/excel-programming/330134-vba-routine-print-list-documents-worksheets.html)

Mirsten Choiple[_2_]

vba routine to print a list of documents/worksheets
 
If someone could help me with this I'd be most grateful.

I would like to have the name of a document in A1 and the number of copies
to be printed in B1.

(and so on down the column)

all documents, spreadsheets are formatted to fit on one page and they are
all in the same directory.

regards,
DL



Chip Pearson

vba routine to print a list of documents/worksheets
 
Try something like the following:

Dim Rng As Range
Dim WB As Workbook
For Each Rng In ActiveSheet.UsedRange.Columns(1).Cells
Set WB = Workbooks.Open(Filename:=Rng.Text)
WB.Worksheets(1).PrintOut copies:=Rng(1, 2).Value
WB.Close savechanges:=False
Next Rng


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Mirsten Choiple" wrote in message
...
If someone could help me with this I'd be most grateful.

I would like to have the name of a document in A1 and the
number of copies to be printed in B1.

(and so on down the column)

all documents, spreadsheets are formatted to fit on one page
and they are all in the same directory.

regards,
DL





Mirsten Choiple[_2_]

vba routine to print a list of documents/worksheets
 
Thank you Chip; it works beautifully,

DL


"Chip Pearson" wrote in message
...
Try something like the following:

Dim Rng As Range
Dim WB As Workbook
For Each Rng In ActiveSheet.UsedRange.Columns(1).Cells
Set WB = Workbooks.Open(Filename:=Rng.Text)
WB.Worksheets(1).PrintOut copies:=Rng(1, 2).Value
WB.Close savechanges:=False
Next Rng


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Mirsten Choiple" wrote in message
...
If someone could help me with this I'd be most grateful.

I would like to have the name of a document in A1 and the number of
copies to be printed in B1.

(and so on down the column)

all documents, spreadsheets are formatted to fit on one page and they are
all in the same directory.

regards,
DL








All times are GMT +1. The time now is 10:00 PM.

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