CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2001
    Posts
    12

    Opening Excel Spreadsheet

    Hi

    I'm writing a VBA program to open Excel, but I don't know how to open a specific file/spreadsheet to work with.

    this is what i have so far...


    Dim oApp as Object

    set oApp = CreateObject("Excel.Application")
    oApp.Visible = true




    and i want to open dummy.xls...how do I do this? Thanks!

    -Tom


  2. #2
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: Opening Excel Spreadsheet

    To open an Excel file:


    dim oExcel as Object
    dim oWorkBook as Object

    Sub OpenExcel(szExcelFile as string)
    ' create Excel Application Object
    set oExcel = CreateObject("Excel.Application")

    ' Open the file
    set oWorkBook = oExcel.WorkBooks.Open(szExcelFile)

    ' show excel
    oExcel.Visible = true
    End Sub




    -Cool Bizs

    Good Luck,
    -Cool Bizs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured