Click to See Complete Forum and Search --> : Opening Excel Spreadsheet


tomwalsh
May 10th, 2001, 07:03 PM
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

coolbiz
May 11th, 2001, 08:36 AM
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