R
RB Smissaert
Figured out now how to mass update lots of control HelpContextID's and Tags
with Designer:
Sub UpdateHelpContextIDsAndTags()
'to update all the forms HelpContextID's and Tags
'---------------------------------------------------
Dim VBProj As VBProject
Dim VBComp As VBComponent
Dim ctl As Control
Dim i As Long
Dim LR As Long
Dim arr
Set VBProj = ThisWorkbook.VBProject
LR = Cells(65536, 1).End(xlUp).Row
arr = Range(Cells(2, 1), Cells(LR, 7))
For i = 1 To LR - 1
'set the form to deal with
'-------------------------
If i = 1 Then
Set VBComp = VBProj.VBComponents(arr(i, 1))
Else
If arr(i, 1) <> arr(i - 1, 1) Then
Set VBComp = VBProj.VBComponents(arr(i, 1))
End If
End If
With VBComp.Designer
'set the control to deal with
'----------------------------
Set ctl = .Controls(arr(i, 4))
'update the control
'------------------
If Len(arr(i, 6)) > 0 Then
ctl.HelpContextID = Val(arr(i, 6))
End If
If Len(arr(i, 7)) > 0 Then
ctl.Tag = arr(i, 7)
End If
End With
Next
End Sub
What I couldn't figure out though how to do the same for the HelpContextID's
of the UserForms.
It is less important as there are obviously much less forms than controls,
but I would be interested if
this were possible.
RBS
with Designer:
Sub UpdateHelpContextIDsAndTags()
'to update all the forms HelpContextID's and Tags
'---------------------------------------------------
Dim VBProj As VBProject
Dim VBComp As VBComponent
Dim ctl As Control
Dim i As Long
Dim LR As Long
Dim arr
Set VBProj = ThisWorkbook.VBProject
LR = Cells(65536, 1).End(xlUp).Row
arr = Range(Cells(2, 1), Cells(LR, 7))
For i = 1 To LR - 1
'set the form to deal with
'-------------------------
If i = 1 Then
Set VBComp = VBProj.VBComponents(arr(i, 1))
Else
If arr(i, 1) <> arr(i - 1, 1) Then
Set VBComp = VBProj.VBComponents(arr(i, 1))
End If
End If
With VBComp.Designer
'set the control to deal with
'----------------------------
Set ctl = .Controls(arr(i, 4))
'update the control
'------------------
If Len(arr(i, 6)) > 0 Then
ctl.HelpContextID = Val(arr(i, 6))
End If
If Len(arr(i, 7)) > 0 Then
ctl.Tag = arr(i, 7)
End If
End With
Next
End Sub
What I couldn't figure out though how to do the same for the HelpContextID's
of the UserForms.
It is less important as there are obviously much less forms than controls,
but I would be interested if
this were possible.
RBS