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 DownloadStockQuotesFromYahoo()
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.DownloadYahooFinanceStockData("MSFT")
REM Download Google Stock Quotes
oComAddinObject.DownloadYahooFinanceStockData("GOOG")
REM Download Netflix Stock Quotes
oComAddinObject.DownloadYahooFinanceStockData("NFLX")
End Function