0

I declared all the variables on my code, I can't understand why I have this type of errror :

enter image description here

enter image description here

My code is :

Option Explicit

Sub Code_Isin()
    Application.Run "RefreshAllStaticData"
    Dim xlCalc As XlCalculation
    Dim ws As Object
    Dim Num_Ligne As Long
    Dim BloombergUI As Object

    For Each ws In Worksheets
    
    Num_Ligne = 2
       
        xlCalc = Application.Calculation
        Application.Calculation = xlCalculationAutomatic

            While ws.Cells(Num_Ligne, 1) <> ""
                ws.Cells(Num_Ligne, 2).Formula = "=BDP(""" & ws.Cells(Num_Ligne, 1).Value & "Equity"" , ""NAME"")"
                BloombergUI.RefreshAllStaticData
                Num_Ligne = Num_Ligne + 1
            Wend
            
            Do Until Application.CalculationState = xlDone
            Loop
    Next

End Sub
Brian M Stafford
  • 8,483
  • 2
  • 16
  • 25
VBA_Anne_Marie
  • 373
  • 3
  • 15
  • 1
    You need to `Set` BloombergUI to something valid before you can use it. Right now it is `Nothing`. – Brian M Stafford Aug 10 '21 at 13:09
  • @BrianMStafford thank you, do yo have the example of code, please ? I can't find it on Internet – VBA_Anne_Marie Aug 10 '21 at 13:27
  • BloombergUI is not an `Object` it is an add in. Maybe this will help solve your issue: https://stackoverflow.com/questions/12856979/how-to-refresh-load-rtd-bloomberg-function-bdh-in-excel-in-vba – Kevin Aug 10 '21 at 13:44
  • @Marie I'm afraid I know nothing about Bloomberg. However, there are a number of questions on this site that may be helpful to you, including the link from Kevin. – Brian M Stafford Aug 10 '21 at 13:50

0 Answers0