Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Toggle Button Updating Concern

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Toggle Button mick2 Excel Discussion (Misc queries) 5 November 27th 05 05:52 AM
Toggle button keithl816 Excel Discussion (Misc queries) 2 November 21st 05 09:16 PM
Toggle Button Dave_2k5 Excel Discussion (Misc queries) 2 September 1st 05 11:27 AM
Toggle Button Keri[_2_] Excel Programming 2 May 28th 04 04:58 PM
Toggle Button Ben E[_2_] Excel Programming 1 October 29th 03 04:42 PM


All times are GMT +1. The time now is 06:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"