Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

Using the CreateObject Function to Create a Late-Bound Instance of Excel

Sub LateBinding()     'Declare a generic object variable     Dim objExcel As Object     'Point the object variable at an Excel application object     Set objExcel = CreateObject("Excel.Application")     'Set properties and execute methods of the object     With objExcel         .Visible = True         .Workbooks.Add         .Range("A1") = "Hello World"     End With End Sub