Display a StockChart In UserForm

S

Sandip Patel

I am trying to display stock chart in the excel userform using the following codes but it is not working. I am using a SMF-Add In in the excel. But to display the chart I am not using this function.

Please let me know what I am doing wrong.

Private Sub txtSymbol_AfterUpdate()
'show the current trading price of the stock
Dim Symbol As String
Dim CompanyName
Symbol = txtSymbol.Text


Dim URL1 As String
Dim URL2 As String
Dim b() As Byte
Dim f As Long
URL1 = n1.Text
URL2 = "http://stockcharts.com/h-sc/ui?s=AAPL&p=D&b=5&g=0&id=p52540482287" & n1
b() = Inet1.OpenURL(URL2, icByteArray)
'/// putting your images url in here ^^^
f = FreeFile
Open App.Path & "\img.gif" For Binary Access Write As #f
Put #f, , b()
Close #f

Image1.Picture = LoadPicture(App.Path & "\img.gif")
Kill App.Path & "\img.gif"

currentPrice = RCHGetYahooQuotes(Symbol, "l1")
CompanyName = RCHGetYahooQuotes(Symbol, "n")
lblCurrentPrice.Caption = currentPrice(1, 1)
lblCompanyName.Caption = RCHGetElementNumber(txtSymbol.Text, 13862)
lblVol.Caption = RCHGetElementNumber(txtSymbol.Text, 26)

If lblVol.Caption >= 500000 Then
lblVol.BackColor = vbGreen
Else
lblVol.BackColor = vbRed
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top