Thread: Late Binding
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Late Binding

It looks strange doesn't it.
GetObject has two optional arguments. The comma is just a quick way of
getting to the second argument.
You could just as easily write: Set oExcel =
GetObject(Class:="Excel.Application") but it's longer to type and read.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Todd Huttenstine" wrote in message
...
In the code below, on the 2nd line of code where it says: Set oExcel =
GetObject(, "Excel.Application")
What does the "," in (, "Excel.Application") do? WHy is there a comma
there?

On Error Resume Next
Set oExcel = GetObject(, "Excel.Application")
On Error GoTo 0
If oExcel Is Nothing Then
'Excel wasn't open - open a new one
Set oExcel = GetObject("", "Excel.Application")
End If