Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Check the 'GetObject Function' (w/o the quotes) in XL VBA help.
-- Regards, Tushar Mehta www.tushar-mehta.com Business solutions leveraging technology Microsoft Most Valuable Professional (MVP) 2000-2004 In article , says... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Todd,
This is because GetObject has two parameters, pathname and class. You can use it by specifying the pathname of a file, or the application class, or both. If you omit the form er, you must have the latter, a class. By the way, GetObject is not late binding. You can use GetObject with late or early binding. What makes it late or early is whether a reference to the type library is set or not. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VB Extensibility library and "late binding" | Excel Discussion (Misc queries) | |||
Late Binding | Excel Programming | |||
EARLY binding or LATE binding ? | Excel Programming | |||
DAO Late Binding? | Excel Programming | |||
Early vs Late Binding - Word | Excel Programming |