Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The first thing that I notice in your code that puzzles me is why are you using
Application.Run "???" instead of just calling procedures? I am not sure if or what problems doing this might cause. That being said you are not showing the subprocedures that you are invoking so it is a little tought to debug. Have you tried stepping through the code using F8 to see where the for is being re-initialized? That is where I would start... HTH "Nicole B" wrote: I have some toggle buttons on a "home page" worksheet in my workbook. I have some VBA code programmed that updates their values based on a property of a cell, for example, if a cell is protected the toggle button displays "unprotect cells" so that the user knows that the button will remove protection. Additionally, when these buttons are clicked, a userform comes up prompting for a password before removing protection (not all of my users have excel 2002 or better, so I'm forced to protect my document this way). If the password is correct it runs a macro and is supposed to UnLoad the userform. The code on the worksheet (for the button) is as follows: Private Sub ProtectionToggle_Click() If Sheet14.ProtectContents = True Then 'True means that protection is on! With ProtectionToggle .Value = False .Caption = "Protect Sheets" End With Application.Run "RunProtectionPasswordUserForm" ElseIf Sheet14.ProtectContents = False Then ans = MsgBox("Are you sure you want to protect the worksheet?" _ & vbLf & "This action cannot be undone without a password.", vbOKCancel, _ "Confirm Protect Sheets") If ans = vbOK Then With ProtectionToggle .Value = False .Caption = "Begin Advanced Editing" End With End If Application.Run "WorkbookProtect" End If End Sub The code for the userform OK button is as follows: Private Sub OKButton_Click() Application.Run "FilterEstimateData.ConfirmPassword" UnLoad Me End Sub The problem that I am having is that the userform is, in fact, unloading, but reloading. It consistently unloads upon OK then reloads once (if I hit OK again with the right password, it does not reload again). Any suggestions? Please help! NB |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Toggle Button | Excel Discussion (Misc queries) | |||
Toggle button | Excel Discussion (Misc queries) | |||
Toggle Button | Excel Discussion (Misc queries) | |||
Toggle Button | Excel Programming | |||
Toggle Button | Excel Programming |