从结构合并数组



我正在尝试对Outlook邮箱的所有子文件夹运行DASL查询,然后在每个文件夹循环后将结果合并到主数组中。我已经尝试了以下方法,但无法实现。任何指导或建议都会有所帮助

strFilter = "@SQL=" & "urn:schemas:httpmail:datereceived <> ''"
Dim eFolder as Outlook.Folder =  myNamespace.Folders("ABC@xyz.com").Folders("Inbox")
Dim oT As Outlook.Table = eFolder.GetTable(strFilter)
Dim RowCount As Integer = oT.GetRowCount
Dim VarArray As Array
VarArray = oT.GetArray(RowCount)
'THIS DOES NOT WORK ----- VarArray=VarArray.Union(Ot.GetArray(RowCount))

我试过了

您需要通过遍历表中数组中的所有条目来手动创建新数组。例如,您可以通过以下方式遍历所有项目:

'Get all items in Inbox that meet the filter 
Set oTable = oFolder.GetTable(Filter) 
On Error GoTo Err_Trap 
varArray = oTable.GetArray(oTable.GetRowCount) 
'Number of rows is the second dimension of the array 
ubRows = UBound(varArray, 2) 
'Number of columns is the first dimension of the array 
ubCols = UBound(varArray) 
'Array is zero-based 
'Rows corrspond to items in the table, so for each item... 
For j = 0 To ubRows 
'Columns correspond to properties in the table, print the value of each property 
For i = 0 To ubCols 
Debug.Print varArray(i, j) 
Next 
Next 
Exit Sub 
Err_Trap: 
Debug.Print "Error#:" & Err.Number & " Desc: " & Err.Description 
Resume Next 

最新更新