deepfriedcheese
New Member
- Joined
- Aug 6, 2010
- Messages
- 21
I have a questionnaire that has a few hundred checkboxes (not ActiveX checkboxes) that users complete as a part of our quality control process. Depending on the nature of the job different boxes need to be available, so each checkbox has been named according to when it is to be displayed. An example of this naming convention is "01b-IR-MgrYN-xBx-GYN". Each of the 5 portions of the name are used to determine whether it is visible. As you can imagine, this is a royal pain when a new step is added and what used to be checkboxes 02a... through 82d... all have to be renamed to 03a... through 83d...
I have created a userform (running in vbModeless) that I want to use to automate this process, but when I try to update the name of a checkbox from the private sub, I get error 70, permission denied. So I put a sub in a public module to handle the renaming and called it from the private sub using public variables. No luck, same error. Here is a code snippet that is attempting to change 01b-IR-MgrYN-xBx-GYN to 01b-IR-MgrYN-ABx-GYN. A very minor, but important change in the fourth criteria.
My public variables are:
A checkbox on the userform indicates that Jobtype "A" should be present and runs this code:
At the end of that code I have the follwing values in the public variables:
currentactivename = 01b-IR-MgrYN-xBx-GYN
newactivename = 01b-IR-MgrYN-ABx-GYN
The RenameBoxes macro is very simple:
Sheets("Questionnaire").Shapes(currentactivename).Name = newactivename is where I get the error. I know the variables are in place because I've tracked them through. I can run this code on its own and it works. But when the userform is active, I can't seem to get it to work inside the private module or in the public one.
This doesn't seem like it should be that hard, so I'm sure I'm missing something simple. Any ideas?
I have created a userform (running in vbModeless) that I want to use to automate this process, but when I try to update the name of a checkbox from the private sub, I get error 70, permission denied. So I put a sub in a public module to handle the renaming and called it from the private sub using public variables. No luck, same error. Here is a code snippet that is attempting to change 01b-IR-MgrYN-xBx-GYN to 01b-IR-MgrYN-ABx-GYN. A very minor, but important change in the fourth criteria.
My public variables are:
Code:
Public currentactivename As String
Public newactivename As String
A checkbox on the userform indicates that Jobtype "A" should be present and runs this code:
Code:
Private Sub JobTypeCBA_Click()
currentactivename = UserForm1.ActiveName.Value
If UserForm1.JobTypeCBA.Value = True Then
UserForm1.ActiveJobType.Value = "A" & Right(UserForm1.ActiveJobType, 2)
Else
UserForm1.ActiveJobType.Value = "x" & Right(UserForm1.ActiveJobType, 2)
End If
newactivename = UserForm1.ActiveLineNumber & "-" & _
UserForm1.ActiveColumnType & "-" & UserForm1.ActiveManagerIndicator & "-" & _
UserForm1.ActiveJobType & "-" & UserForm1.ActiveGroup
Module2.RenameBoxes
End Sub
At the end of that code I have the follwing values in the public variables:
currentactivename = 01b-IR-MgrYN-xBx-GYN
newactivename = 01b-IR-MgrYN-ABx-GYN
The RenameBoxes macro is very simple:
Code:
Sub RenameBoxes()
Sheets("Questionnaire").Shapes(currentactivename).Name = newactivename
End Sub
Sheets("Questionnaire").Shapes(currentactivename).Name = newactivename is where I get the error. I know the variables are in place because I've tracked them through. I can run this code on its own and it works. But when the userform is active, I can't seem to get it to work inside the private module or in the public one.
This doesn't seem like it should be that hard, so I'm sure I'm missing something simple. Any ideas?