Sabtu, 31 Oktober 2015

[smf_addin] Digest Number 3548

1 Message

Digest #3548

Message

Fri Oct 30, 2015 5:41 am (PDT) . Posted by:

wongkayau

Hi Randy,


Morning. I finally find the way to download GB2312. I have written (copy from other website and modify) a small macro to download data. It works.


Sub simplified()
Dim strRespText$, tt$, i&, DW$
Dim URL
URL = "http://money.finance.sina.com.cn/corp/go.php/vFD_FootNotes/stockid/002202.phtml"
With CreateObject("Microsoft.XMLHTTP")
.Open "GET", URL, False
.Send
tt = StrConv(.ResponseBody, vbUnicode)
tt = Replace(tt, vbCrLf, "")

End With
Cells(33, 4).Value = tt

End Sub



I want to change it as a function to facilitate the download, but it doesn't work.


Function simplified()
Dim strRespText$, tt$, i&, DW$
Dim URL
URL = "http://money.finance.sina.com.cn/corp/go.php/vFD_FootNotes/stockid/002202.phtml"
With CreateObject("Microsoft.XMLHTTP")
.Open "GET", URL, False
.Send
tt = StrConv(.ResponseBody, vbUnicode)
tt = Replace(tt, vbCrLf, "")

End With
simplified = tt

End Function



I type "=simplified()" in a blank cell which shows "#VALUE!". Could you please tell me what's wrong? Sorry, I am elementary on excel VB.


Thank you very much for your help.


Cheers,
Laurent


For the Add-in, Documentation, Templates, Tips and FAQs, visit http://ogres-crypt.com/SMF

Tidak ada komentar:

Posting Komentar