[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Help with ActiveX component



PureBytes Links

Trading Reference Links

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@xxxxxxx>
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@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/ 
> 
> 
> 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Low on Ink? Get 80% off inkjet cartridges & Free Shipping at 77Colors.com.
We have your brand: HP, Epson, Lexmark, Canon, Compaq and more!
http://www.c1tracking.com/l.asp?cid=5981
http://us.click.yahoo.com/DmnqpB/IyhGAA/ySSFAA/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/