当涉及到循环时,我不是最先进的教授,所以我有点卡在这里。
通常我会像这样使用它:
Dim ouLookup: Set ouLookup = CreateObject("MFilesAPI.Lookup")
Dim ouLookups: Set ouLookups = CreateObject("MFilesAPI.Lookups")
ouLookup.Item = ThisWorkbook.Sheets("Sheet1").Range("E1").Value
ouLookup.Version = -1
ouLookups.Add -1, ouLookup
ouLookup.Item = ThisWorkbook.Sheets("Sheet1").Range("E2").Value
ouLookup.Version = -1
ouLookups.Add -1, ouLookup
etc.
通过这段代码,我们将用户 ID 添加到我们ouLookups
稍后将在此代码中使用的集合中:
' AssignedToUsers
oPropertyValue.PropertyDef = MFBuiltInPropertyDefAssignedTo
oPropertyValue.Value.SetValueToMultiSelectLookup ouLookups ' It is here
oPropertyValues.Add -1, oPropertyValue
是否可以构建一个循环代码来添加用户 ID?因此它将在从单元格E1
到的循环中执行此操作E35
:
ouLookup.Item = ThisWorkbook... ' Offset or something?
ouLookup.Version = -1
ouLookups.Add -1, ouLookup