Full Version: Printing an Excel sheet from Access
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
Pharkas
Hi,

I need to print an Excel sheet from an Access button.

We have daily reports that get printed, and one of them is from Excel.

How can I print an Excel File from withing Access ?

Thanks,
DataPhreak
Try something like this in your OnClick event of your button:

CODE

Private Sub cmdPrintExcel_Click()

    Dim objXL As Object
    
    Set objXL = CreateObject("Excel.Application")
    
    With objXL.Application
        .Workbooks.Open ("D:\My Documents\DocName.xls")
        .ActiveSheet.PrintOut
        .Quit
    End With
    
    Set objXL = Nothing

End Sub


where ("D:\My Documents\DocName.xls") is the exact path to your document. Good luck!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.