View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
urkec urkec is offline
external usenet poster
 
Posts: 131
Default Getting objects other than 'Excel.Application using GetObject()


I was looking at the GetObject() function help and have a question regarding
these samples:

Set LayerObject = GetObject("C:\CAD\SCHEMA.CAD!Layer3")

and:

Dim MyObject As Object
Set MyObject = GetObject("C:\DRAWINGS\SAMPLE.DRW", "FIGMENT.DRAWING")


The first sample gets a regerence to an object called 'Layer3' contained in
schema.cad. Is anything similar possible for Excel? For Example:



Sub Test()

Set objWorkbook = GetObject("C:\Scripts\Test.xls")
Debug.Print objWorkbook.Name

'Set objSheet = GetObject("C:\Scripts\Test.xls!Sheet1")

End Sub


The first GetObject() call works, but the second call returns an 'invalid
syntax' error. Is it possible to use GetObject() to get reference to objects
other than Excel.Workbook (like Worksheet or any other)?

Thanks in advance.


--
urkec