& ctl.ControlType) _
& “ control currently named “ & pstrOldCtlName _
& vbCrLf & “(source object: “ & pstrSourceObject _
& “) 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 ErrorHandlerExit
End Function
Public Function ControlNA(ctl As Access.Control, _
strPrefix As String, blnTag As Boolean) As Integer
Does group renaming of all controls not fitting the other categories on a form or report.
‘Called from RenameFormControls and RenameReportControls
‘in this module
On Error GoTo ErrorHandler
pstrOldCtlName = ctl.ControlName
Creating COM Add-ins with Visual Basic 6 13