Sub PrintExcelFile()
'1st ==> Set a Reference to the Microsoft Excel X.X Object Library
Dim strPathToExcel As String, strSpreadsheetName As String
Dim strWorksheetName As String
Dim ExcelApp As New Excel.Application
Dim ExcelBook As New Excel.Workbook
Dim ExcelSheet As New Excel.Worksheet
'******* Substitute your own values ********
strPathToExcel = "M:\"
strSpreadsheetName = "EIA template.xlsx"
strWorksheetName = "Sheet1"
'*****************************************'*
'Let's not see what is going on
ExcelApp.Visible = False
Set ExcelBook = ExcelApp.Workbooks.Open(strPathToExcel & strSpreadsheetName)
Set ExcelSheet = ExcelBook.Worksheets(strWorksheetName)
ExcelSheet.PrintOut
ExcelApp.Quit
Set ExcelApp = Nothing
End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE