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

Explain about Caturing Baseline.

622


How do I mimic a toggle button?

1004


_____ collection in recordset used to assign a value from textbox to table columns without making abinding in datacontrol.

1292


What is data binding in vb net?

489


Explain the working of templates?

564






Is it possible to change menu runtime using API? If yes? Specify the function names.

1535


How would you Create a Query Builder and Explain its uses

1436


How come I get a "No Current Record" error when I use a a Data Control on an empty table?

1042


what is the Difference between Recordset and Querydef?

1854


What is the use of OLE?

2027


How do I make a text box not beep but do something else when I hit the Enter key?

976


what is the Difference between Dynaset and Snapshot?

1496


What are the types of API Types.

1686


How do I make the mouse cursor invisible/visible?

921


What is the use of Tabledef?

1545