当我陷入循环中时,我不是最高级的教授,所以我有点被困在这里。
通常我会像这样使用它:
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
循环非常简单,在线上有大量的教程。一定要看一下:)
这里是如何使用循环的方法
'set range
Set myrng = ThisWorkbook.Sheets("Sheet1").Range("E1:E35")
'loop through each cell in range
For Each cel In myrng
'this is how you cna access the value
MsgBox cel.Value
Next