PureBytes Links
Trading Reference Links
|
This is explained just a few days ago. It basically has to do with
the fact that the collection takes a string or number as the key. A
search in the newsgroup on CStr should get you to Tomasz' precise
explanation.
Gordon
--- In amibroker@xxxxxxxxxxxxxxx, "Email" <romadd64@xxxx> wrote:
> Tomasz,
>
> why we must convert the var Ticker (it is already a string type),
to
> another string via CStr ?
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "au99991" <auttley@xxxx> wrote:
> > Tomasz,
> >
> > Your experience is as invaluable as ever! Many thanks.
> >
> > Andy.
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
> <amibroker@xxxx>
> > wrote:
> > > Hello,
> > >
> > > You have to call CStr as follows:
> > >
> > > Set oStk = oStocks.Item( CStr( Ticker ) )
> > >
> > > Best regards,
> > > Tomasz Janeczko
> > > amibroker.com
> > > ----- Original Message -----
> > > From: "au99991" <auttley@xxxx>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Saturday, August 09, 2003 1:10 PM
> > > Subject: [amibroker] Help with ActiveX component
> > >
> > >
> > > > I'm trying to access the Amibroker object collection from a
VB
> > > > activex function. Please ignore what the function is doing -
> I'm
> > > > just trying to get the basic function-calling correct.
> > > >
> > > > The function in VB reads:
> > > >
> > > > Public Function StockFN() As Variant
> > > >
> > > > Dim Ticker As String, oAB As Object, oStocks As Object,
> oStk
> > As
> > > > Object
> > > >
> > > > Set oAB = CreateObject("Broker.Application")
> > > >
> > > > Ticker = oAB.ActiveDocument.Name
> > > >
> > > > Set oStocks = oAB.Stocks
> > > >
> > > > Set oStk = oStocks.Item(Ticker) '!!
> Error
> > line
> > > >
> > > > StockFN = oStk.Fullname
> > > >
> > > > End Function
> > > >
> > > > I call it in a guru commentary with the following code:
> > > > myAB = CreateObject("MyAB.Common");
> > > > myAB.StockFN();
> > > >
> > > > This gives an 'Object variable not set error' in VB.
However,
> I
> > know
> > > > that the Ticker variable is correctly loaded and if I replace
> > Ticker
> > > > for a hardcoded ticker value in the error line above, the
> > function
> > > > returns a value albeit obviously for the hardcoded ticker
> value.
> > > > Would much appreciate a pointer on what I'm doing wring as
I'm
> > > > getting no where!
> > > >
> > > > Many thanks
> > > >
> > > > Andy.
> > > >
> > > >
> > > >
> > > > Send BUG REPORTS to bugs@xxxx
> > > > Send SUGGESTIONS to suggest@xxxx
> > > > -----------------------------------------
> > > > Post AmiQuote-related messages ONLY to:
> amiquote@xxxxxxxxxxxxxxx
> > > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > --------------------------------------------
> > > > Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > >
> > > > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> > > >
> > > >
> > > >
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|