Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 使用动态数据从Excel启动业务对象查询_Vba_Excel_Business Objects - Fatal编程技术网

Vba 使用动态数据从Excel启动业务对象查询

Vba 使用动态数据从Excel启动业务对象查询,vba,excel,business-objects,Vba,Excel,Business Objects,我需要每天启动一个业务对象报告,在一个名为“phone”的维度中修改电话号码列表。我希望有一个Excel文件,我可以在其中设置我希望在BO universe中查找的电话号码,启动报告并保存结果。我已经修改了我找到的一个示例,但我不知道如何使用报告的VBA代码修改条件。如果我只想刷新报告,它工作正常,但从不添加或更新条件的de值。有什么想法吗 在我的Excel中,我将单元格中的信息作为变量传递给VBA函数: C2 = Business Object login C3 = Business Obje

我需要每天启动一个业务对象报告,在一个名为“phone”的维度中修改电话号码列表。我希望有一个Excel文件,我可以在其中设置我希望在BO universe中查找的电话号码,启动报告并保存结果。我已经修改了我找到的一个示例,但我不知道如何使用报告的VBA代码修改条件。如果我只想刷新报告,它工作正常,但从不添加或更新条件的de值。有什么想法吗

在我的Excel中,我将单元格中的信息作为变量传递给VBA函数:

C2 = Business Object login
C3 = Business Object password
C4 = BO report path
C5 = Exported results path
C6 = list of phone numbers separated with "," o ";" (whatever is needed)
我从Excel运行的VBA代码:

Sub Exec_BO_Query()
    Dim BoApp As Object
    On Error Resume Next
    Set BoApp = CreateObject("BusinessObjects.application")
    With BoApp
        .Visible = True
        .LoginAs Worksheets("Configuration").Range("C2").Value, Worksheets("Configuration").Range("C3").Value, False
        .Documents.Open (Worksheets("Configuration").Range("C4").Value)
             With .ActiveDocument
                  .Queries.Item(1).Conditions.Add "Phone number", "Phone", "In list", Worksheets("Configuration").Range("C6").Value 
                  .Refresh
                  .SaveAs Worksheets("Configuration").Range("C5").Value
                  .Close
            End With
        .Application.Quit
    End With
    Set BoApp = Nothing
    Workbooks(ThisWorkbook.Name).RefreshAll
End Sub
我不知道如何正确地使用这些条件(甚至我也不知道是否使用了正确的对象)。文档中的语法如下所示:

var.Add(class, objectorcondition, [operator], [operand1], [operand1type], [operand2], [operand2type])

var is the name of the Conditions variable that you declare.
class is a string that identifies the class.
objectorcondition is a string that identifies the condition.
operator identifies the operation. This parameter is optional.
operand1, operand2 are each operands for the condition. These parameters are optional.
operand1type, operand2type are each operand types for the corresponding operator. These parameters are optional.

谢谢你的帮助

您好Juagar-我对业务对象不太了解,但它看起来确实像您的
条件。Add
行缺少一些逗号。您是对的,在示例中缺少逗号,但在我的代码中,这些逗号是编写的,工作不好(代码运行并刷新de report,但不会将条件添加到报告中)。我要纠正问题中的错误,谢谢!以下是我的真实代码:。查询。项(1)。条件。添加“Información de la orden”、“ID orden”、“列表中”、“90388590”是否需要从Excel中执行此操作?你通常有多少个电话号码?电话号码的最大数目是多少?