-
I just modified it so that if an Instance of Excel is already running to use that. If XL is running already, this executes very quickly!
[VBA]Public Function ddIndex(CC As ContentControl, RangeText As String) As Long
'Returns the location of a given DropDown Content Control's Selection within
'it's list of Dropdown List entries
Dim XL As Object
'Dim bStartedXL As Boolean
Dim arrDD() As Variant
ReDim arrDD(1 To CC.DropdownListEntries.Count)
For d = 1 To CC.DropdownListEntries.Count
arrDD(d) = CC.DropdownListEntries.Item(d).Text
Next d
On Error Resume Next
Set XL = GetObject(, "Excel.application")
If XL Is Nothing Then
set XL = CreateObject("Excel.application")
'bStartedXL = True
End If
On Error GoTo 0
ddIndex = XL.Application.match(RangeText, arrDD, 0)
Set XL = Nothing
End Function[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules