Excel VBA Script that Downloads Historical Stock Data from Google Finance and Imports it into a Spreadsheet

Before running this script, you must first install DownloadGT.
Option Explicit
REM We use "Option Explicit" to help us check for coding mistakes' 
REM Run Excel, then Press Alt+F11 to open VBA
REM Programming by Greg Thatcher, http://www.GregThatcher.com

Function DownloadStockQuotesFromGoogle()
    Dim oCOMAddin
    Dim oComAddinObject
    
    Set oCOMAddin = Application.COMAddIns.Item("DownloadGT.Connect")
    If Err.Number <> 0 Then
        MsgBox "There was an error retrieving a reference to DownloadGT!  Make sure it is installed!"
        Exit Function
    End If
    'Check to see whether the COM add-in is connected
    If oCOMAddin.Connect = False Then
        MsgBox _
            "DownloadGT must be enabled inside Excel before you can call its methods!"
        Exit Function
    End If
   
    Set oComAddinObject = Application.COMAddIns.Item("DownloadGT.Connect").Object
    
    REM Download Microsoft Stock Quotes
    oComAddinObject.DownloadGoogleFinanceStockData("MSFT")
    REM Download Google Stock Quotes
    oComAddinObject.DownloadGoogleFinanceStockData("GOOG")
    REM Download Netflix Stock Quotes
    oComAddinObject.DownloadGoogleFinanceStockData("NFLX")
   
End Function