VBA to get input from user

Hi All,

I am using BO 6.5.1. I am trying to build a macro which will take the input from the VBA code itself or from an excel file. I am using below codes. The 5th or 6th line is not working for me. Please help or guide me in BO macro. Thanks in advance to all of you for your help.


    Dim Doc As Document
    Dim Rep As Report
    Set Doc = Application.Documents("Document2")
    Dim DV As DocumentVariable
    Doc.DocumentVariables("ECODE").Formula = "= 6123456;6234567" 'These are employee codes
    Doc.DocumentVariables("ECODE").Formula = "= " & Workbooks("InputECODE").Sheets("ECODE").range("A2:B2").Value  'These are employee codes in excel
    Doc.Refresh
    Doc.Save

The error for 5th line is “Run time error 50 . Cannot change the formula of a non user variable” .

Regards
taps


taps (BOB member since 2017-04-27)