--- In [email protected], "aajurg" <aaj...@...> wrote:
>
> yes that's exactly my problem I don't know if I must use a early
> binding or a late binding with my VBA code .
> 
> It seems taht this line 
> 
> Dim Amibroker as broker.application  'It is a early binding but It
> don't walk on my computer ?
> 
> Dim Amibroker as Object ' It is a late binding , it's better but I
> meet a bug with the method ".refreshall" 

You didn't mention your error message but your problem is probably
because RefreshAll is a Sub so you cannot assign the return value to
collectiondestock.  Get rid of the "Set collectiondestock = " and just
use:

Amibroker.RefreshAll()


That should help,

Tuzo
 
> Sub test()
> 
> Dim derlign As Integer
> derlign = Worksheets(1).Range("A65536").End(xlUp).Row + 1
> 
> Dim Amibroker As Object
> 'Dim Amibroker As Broker.application 'is not accepted
> ' I thougth that by using the file Broker4705.tlb then this VBA line
> will be accepted ...For the instant I don't understand this file and
> my computer is not a server .
> Set Amibroker = CreateObject("Broker.application")
> 
> Dim i As Integer
> Dim a, b, c As String
> Dim collectiondestock As Object
> 
> For i = 1 To derlign
> 
> a = Val(Left(Cells(i, 6).Value, 1)) 'sector's number
> 'a = Left(a, 1)  'keep only the first number
> b = Cells(i, 5).Value & ".PA" 'catch the ticker
> c = Cells(i, 1).Value 'catch the complete name
> 
> 
> 
> If a <> 0 Then  
> Set collectiondestock = Amibroker.stocks.Add(b)
> collectiondestock.FullName = c
> collectiondestock.IndustryID = a
> End If
> 
> Next i
> 
>    Set collectiondestock = Amibroker.RefreshAll()   'BUG ...
>    ' It is not the good variable's size 
>    Set Amibroker = Nothing
> 
> End Sub
>


Reply via email to