Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open an Excel file using VB 1

Status
Not open for further replies.

mike777

Programmer
Jun 3, 2000
387
US
I've tried shell("path\filename.xls") and, obviously that doesn't work.
So, I've tried
Workbooks.Open "filename.xls" and get the "object needed" error.
I've tried
Getobject ("path\filename.xls"), etcetc.
I just need to open an excel spreadsheet from the vb application. Thanks for your help. [sig][/sig]
 
Hey Mike

I am looking for the exact same thing if you find something please let me know.

Thanks
John
 
Hi Mike

This is the way, hope it helps. I have done loads of this type so if you need more help let me know.
I have put a msgbox in so it wont shut it down immediately following. If you did not say myexcel = visible it is still opened but not visible to your screen, ideally for bacground processing.

Kind regards

Andy Nicholas

Function Excel_Example()
Dim myExcel As Object

Set myExcel = CreateObject("Excel.Application")

myExcel.Visible = True

myExcel.workbooks.Open Filename:="D:\My Documents\forumExample.xls"

MsgBox ("I am Here")

myExcel.workbooks("forumExample.xls").Close

myExcel.Quit

End Function
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top