• 146 views | 3 messages Discussion: LEAP
    Topic: Exporting Scenarios names (LEAP API)Subscribe | Previous | Next
  • Andre Siqueira 10/18/2019

    1 Like

    Hi,

    I'm trying to export all the scenarios to excel using the code below:

    For s = 3 To L.Scenarios.MaxID
    Worksheets("Sheet1").Range("C1").Offset(m1, t1) = L.Scenarios(s).Name
    t1 = t1 + 1
    Next

    But using the "L.Scenarios.MaxID" it's not working. Then, I need to manually enter the number of scenarios that I have. Is there a way to make it smarter?

    I have 8 scenarios in my model, but when I print the value of L.Scenarios.MaxID it returns me 11. The program works well until the 8th item.

    Thank you!





  • Emily Ghosh 10/21/2019
      Best Response

    2 Likes

    Hi Andre,

    Scenarios.MaxID refers to the ID number of the last scenario. If you are looking for the total number of scenarios in your model, you should use Scenarios.Count.

    Thanks,
    Emily

  • Andre Siqueira 10/21/2019
      Best Response

    1 Like

    It's working!

    Thank you!!!