Mega Code Archive

 
Categories / VisualBasic Script / Application
 

Returning an Object with the GetObject Function

Sub Return_a_Value_from_Excel()      Dim mySpreadsheet As Excel.Workbook      Dim strSalesTotal As String      Set mySpreadsheet = GetObject("your.xls")      strSalesTotal = mySpreadsheet.Application.Range("SalesTotal").Value       Set mySpreadsheet = Nothing       Selection.TypeText "Current sales total: $" & strSalesTotal & "."       Selection.TypeParagraph   End Sub