What is the diff between the Create Object and Get object?

Answer Posted / abcd

1. CreateObject creates an instance of a class
2. GetObject gets the reference of an running object
to another object
3. Always use CreateObject except for Windows
Management Instrumentation (WMI) and Active Directory
Service Interfaces (ADSI)
The below script demonstrates the use of these two VBScript
functions.
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add

Set objExcel2 = GetObject(, "Excel.Application")
Set objWorkbook = objExcel2.Workbooks(1)
Set objWorksheet = objWorkbook.Worksheets(1)
objExcel2.Cells(1, 1).Value = "In god I TRUST everything
else I TEST."

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of Data Form Wizard?

1711


What is the use of command Object?What are the various types of variables?

803


How do I speed up control property access?

1202


How do I create a new form in visual basic?

745


what is the Difference between Dynaset and Snapshot?

1725


How would you convert a form into document?

1552


Which type of object requires this object?

1759


Explain about the creation of EXE files with Visual Basic?

764


What is the difference between change event in normal combobox and dbcombobox?

1841


What are the important components of OLEDB?

2618


What is meant by Establish Connection in RDO?

1883


What is the use of Tabledef?

1741


How do I set the Windows wallpaper at runtime?

1320


State about the different types of visual basic data?

756


DHTML Is used for what?

1648