ElseIf Right(pstrNewCtlName, 5) = “Label” Then
pstrNewCtlName = Left(pstrNewCtlName, _
Len(pstrNewCtlName) - 5)
End If
pintRenameFail = True
Do While pintRenameFail
pintRenameFail = False
pintReturn = MsgBox(“Rename “ _
& DLookup(“[ControlTypeName]”, _
“zLNCtblControlType”, “[ControlType] = “ _
& ctl.ControlType) _
& “ control currently named “ & pstrOldCtlName _
& vbCrLf & “(caption: “ & strCaption & “) to” _
& vbCrLf & pstrNewCtlName & “?”, vbYesNo + _
vbQuestion + vbDefaultButton1, “Rename control”)
If pintReturn = vbYes Then
If blnTag = True Then ctl.Tag = ctl.ControlName
ctl.ControlName = pstrNewCtlName
ElseIf pintReturn = vbNo Then
pstrNewCtlName = _
InputBox(“Modify new control name”, _
“Rename control”, pstrNewCtlName)
ctl.ControlName = pstrNewCtlName
End If
Loop
ErrorHandlerExit:
Exit Function
ErrorHandler:
If the proposed control name is already in use, return to the renaming dialog.
pintRenameFail = True
If Err.Number = 2104 Then
MsgBox “There is another control named “ & _
pstrNewCtlName & “; please try again”, , _
“Control Name Used”
pstrNewCtlName = pstrNewCtlName & “1”
Else
AddInErr Err
Resume ErrorHandlerExit
End If
Resume Next
End Function
Public Function ControlSO(ctl As Access.Control, _
strPrefix As String, blnTag As Boolean) As Integer
Creating COM Add-ins with Visual Basic 6 13