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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Excel Report in VB 1

Status
Not open for further replies.

misssaraliz

Technical User
Feb 14, 2002
12
0
0
US
What is the code to print an Excel spreadsheet in VB? I've only seen code on how to print reports within Access.

I already have code set up that exports and saves the Access report to Excel format. My trouble is with the printing of the Excel spreadsheet.

Thanks so much!
 
This is an example of how I print an Excel Worksheet through VB.
Hope this will help. Good luck...


xlPrice.Worksheets("Sheet1").PageSetup.PrintArea = ("$" & Area & "$1:$" & SecArea & "$40") 'Page Print Area
xlPrice.Worksheets("Sheet1").PageSetup.PrintGridlines = True
With xlPrice.Worksheets("Sheet1").PageSetup
.Zoom = False
.FitToPagesTall = 1
.FitToPagesWide = 1
.LeftMargin = Application.InchesToPoints(0.7)
.RightMargin = Application.InchesToPoints(0.7)
.TopMargin = Application.InchesToPoints(1.1)
.BottomMargin = Application.InchesToPoints(1.1)
End With
xlPrice.ActiveSheet.PrintOut

jbrite
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top