Hello Mike,
I tried it, and it doesn't work. I get an error at the first DIM declaration
Dim sPage As Variant
"Expected end of statement Source: Microsoft _vbscript_ compilation
error"
with the cursor sitting just before the "As" keyword.
Can you help? Sounds like I am doing something silly...
Thanks,
Paul
Here is my AFL / _vbscript_:
EnableScript("_vbscript_");
ticker = Name();
<%
Dim sPage As Variant
Dim iGBP As Variant, iDec As Variant
Dim iStart As Variant, iEnd As Variant
Dim dRate As Variant
Dim earningsURL As Variant
Dim datedebug As Variant
earningsURL = ""http://www.zacks.com/research/report.php?type=estimates&t=""AFL("ticker")""&x=0&y=0"""
Set OIE1 = New SHDocVw.InternetExplorer
OIE1.Navigate earningsURL
do Until OIE1.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
sPage = OIE1.Document.body.InnerHTML
OIE1.Quit
Set OIE1 = Nothing
On Error GoTo DUMMYDATA
iGBP = InStr(1, sPage, "Next Report Date") '+ 12
On Error GoTo DUMMYDATA
iDec = InStr(iGBP, sPage, "&")
iStart = InStrRev(sPage, "align=right>", iDec) + 12
iEnd = InStr(iDec, sPage, "/") - 34
datedebug = Mid(sPage, iStart, iEnd - iStart)
if IsDate(datedebug)
Then
dRate = datedebug
else:
dRate = "=TODAY()+(100)"
End if
Goto END
DUMMYDATA:
dRate = "=TODAY()+(100)"
dRate = Empty
END:
AFL.Var("earningdate") = dRate
%>
--- In amibroker@xxxxxxxxxps.com,
"Mike" <sfclimbers@...> wrote:
>
> You can embed scripting directly into your AFL and exchange variable
values between the two as desired:
>
> http://www.amibroker.com/guide/a_aflcom.html
>
> Additional examples using _vbscript_:
>
> http://www.amibroker.com/guide/a_script.html
>
> Mike
>
> --- In amibroker@xxxxxxxxxps.com,
"polomorabe" <polomora@> wrote:
> >
> > I don't know if this is a stupid question.
> >
> > I have written a VB macro to scrape the Zachs web page to extract the
next earnings date, and paste it into an Excel worksheet cell. Is it possible
to do somehow execute VB from within AB, to get the same information?
> >
> > http://www.zacks.com/research/report.php?type=estimates&t=IBM&x=0&y=0
> >
> > Many thanks,
> > Paul
> >
>