Case acLine
strPrefix = “lin”
i = ControlNA(pctl, strPrefix, blnTag)
Case acPage
strPrefix = “pge”
i = ControlNA(pctl, strPrefix, blnTag)
Case acPageBreak
strPrefix = “brk”
i = ControlNA(pctl, strPrefix, blnTag)
Case acRectangle
strPrefix = “shp”
i = ControlNA(pctl, strPrefix, blnTag)
End Select
Next pctl
Next pfrm
Call MsgBox(“All form controls renamed!”, _
vbOKOnly, “Done”)
ErrorHandlerExit:
Exit Function
ErrorHandler:
If an option button or checkbox is unbound, set blnUnboundto Trueso the code uses the NA
function instead of CS.
If Err.Number = 2455 Then
blnUnbound = True
Resume Next
Else
AddInErr Err
Resume ErrorHandlerExit
End If
End Function
[I am omitting the LNCRenameReportControlsfunction from this listing, because it is sub-
stantially similar to the LNCRenameFormControlsfunction.]
The following procedures rename form and report controls of various types. Controls are grouped
depending on whether or not they are bound, and other relevant properties. Each group of con-
trols (ControlCS, ControlCA, and so forth) needs different code to create an appropriate name for
Creating COM Add-ins with Visual Basic 6 13