ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Display a StockChart In UserForm (https://www.excelbanter.com/excel-programming/444239-display-stockchart-userform.html)

Sandip Patel[_2_]

Display a StockChart In UserForm
 
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


All times are GMT +1. The time now is 01:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com