Opening A Specific Excel Workbook

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Big K Hutch
    New Member
    • Jul 2006
    • 11

    Opening A Specific Excel Workbook

    I am trying to open up a specific workbook labeled below: I can get the application to open but not the specific workbook/spreadsheet. Please help what am I missing?

    Private Sub Command2_Click( )


    Dim ExcelApp As Object
    Dim ExcelBook As Object
    Dim ExcelSheet As Object

    Set ExcelApp = CreateObject("E xcel.Applicatio n")
    Set objExcel = New Excel.Applicati on
    objExcel.Visibl e = True
    objExcel.Book.O pen "c:\KevinSPCToo l.xls", , , True

    End Sub
  • Microjunk
    New Member
    • Sep 2006
    • 1

    #2
    the code to open the specific file should be;

    Private Sub Command2_Click( )

    Dim ExcelApp As Object
    Dim ExcelBook As Object
    Dim ExcelSheet As Object

    Set ExcelApp = CreateObject("E xcel.Applicatio n")
    Set objExcel = New Excel.Applicati on
    objExcel.Visibl e = True
    objExcel.Workbo oks.Open ("Path to the excel file and file name")
    End Sub

    Comment

    Working...