none
Not able to Add a Scenario RRS feed

  • Question

  • I'm getting the following Error while trying to add a Scenario through VBScript Code :-

    "Add method of Scenarios class Failed"

    Can anyone please give me an idea what I might be doing wrong ?

    PS : I'm trying to use VBScript for this task. Altough this is a VBA Forum. but I guess this error message would appear with VBA also

    Wednesday, August 15, 2012 6:35 PM

All replies

  • Post the code.

    Best Regards,
    Asadulla Javed, Kolkata
    ---------------------------------------------------------------------------------------------
    Please do not forget to click “Vote as Helpful” if any post helps you and "Mark as Answer”if it solves the issue.

    Thursday, August 16, 2012 10:55 AM
    Answerer
  • Javed - Thanks for the Reply. The Problem is solved. It was a syntax error. Here's my code :-

    'Creating the Excel Application Object
    Set objExcel = CreateObject("Excel.Application")
    'Creating the Workbook Object
    Set objBook = objExcel.Workbooks.Add
    'Creating the Worksheet Object
    Set objSheet = objExcel.Activesheet

    'Adding the Scenario
    oSheet.Scenarios.Add "Test", "A1", "1"

    I had to change the above line to :-

    oSheet.Scenarios.Add "Test", "A1", Array("1")


    Thursday, August 16, 2012 11:27 AM