GetObject


Posted by Laurinda on January 10, 2001 10:44 AM

We are trying to use GetObject to open up an already existent spreadsheet so that we can change information in that xls or add worksheets to it. Is this possible? We can get CreateObject to work but we do not want a new file every time. Any suggestions?



Posted by Robert on January 11, 2001 6:31 PM

I have a question: from where do you try to open?

If from VB then:

Set MyXL = Getobject(, "Excel.Application")
If Err.Number <> 0 Then ExcelWasNotRunning = True
Err.Clear ' Clear Err object in case error occurred.

Set MyXL = Getobject("c:\vb4\MYTEST.XLS")

If from VBA in Excel, use the open...

R.