Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting excel sheets to print from VBA 1

Status
Not open for further replies.

rwweiland

Programmer
Oct 15, 2003
9
US
Hello all,
I have a program that will allow the user to select a week(numbered 1- 52). When the user selects a week it then gives a list of fields..Ex. FIX-002, FIX-005, etc.

I have a folder in the C: directory named PMs which contains the excel sheets I need to print with the week chosen. The excel sheets and the fields (FIX-002....) are named the exact same.

Can someone help me to figure out how to open the directory needed and read the excel sheet names and print the coinciding sheets with the fields for the week?
 
Hi,

Sounds like...
Code:
fName = "FIX-002" 'however you assign it...
WorkBooks.Open "C:\PMs\" &  fName
activeWorkbook.Worksheets(fName).printout
:)

Skip,
Skip@TheOfficeExperts.com
 
Well you did say there was a list of fields...
Code:
for i = lBound(YourList, 1) to uBound(YourList, 1)
  fName = YourList(i)
  WorkBooks.Open "C:\PMs\" &  fName
  activeWorkbook.Worksheets(fName).printoutnext
:)

Skip,
Skip@TheOfficeExperts.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top