Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Late Binding

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Late Binding

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   Report Post  
Posted to microsoft.public.excel.programming
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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Late Binding

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB Extensibility library and "late binding" Dennis Excel Discussion (Misc queries) 0 March 30th 05 10:51 PM
Late Binding Cindy Excel Programming 11 April 23rd 04 03:34 PM
EARLY binding or LATE binding ? jason Excel Programming 6 February 26th 04 04:57 PM
DAO Late Binding? Sharqua Excel Programming 2 January 4th 04 02:05 AM
Early vs Late Binding - Word John Wilson Excel Programming 6 November 13th 03 03:21 PM


All times are GMT +1. The time now is 01:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"