View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
othello othello is offline
external usenet poster
 
Posts: 5
Default Step-through works, Run does not?

Hello all:
I have a big (lots of code) multipage userform that asks a user for a
password which is on a list in a hidden sheet, in the first column. This
list was previously populated, randomized, by another form, and is different
for each occasion.

When the password is entered the form loops through the first column looking
for a match. If one is found, the form is populated with any existing data
from that row on the sheet, and then allows the user to step through 14 pages
of survey, or save for later at any point in the process. Here's the problem:

The form runs perfectly on my computer (the actual file sits on the public
drive, accessible by all authorized users), but when anyone else tries to run
it, it fails and crashes Excel. All of us are using Excel 2003. If I sit
down at that user's computer, open VBE and step through the procedure to find
the trouble, it goes all the way through and opens the form very nicely.
Further, if I then save it, that user can open it and run it at normal speed
with no trouble - everything works!

It works until I do the same thing from someone else's computer and then
only that person can run it. Except that I can still run it from my
workstation.

So, any hints? Why would step-through work when run won't, and why would
that temporarily fix it, and what does that mean about where to look for the
trouble?

I'll add in the code for the loop here, because that would seem to be the
most likely trouble spot, though it could easily be somewhere else.


Private Sub cmdEnterPassword_Click()
' Check to see if the password is in the evaluation file
Application.ScreenUpdating = False
If txtPassword.Value = "" Then 'Check for blanks
Application.ScreenUpdating = True
MsgBox ("That Password was not found. Please try again.")
End
End If

'Unprotect the sheet and open the hidden sheet to look at passwords
ActiveSheet.Unprotect ("appraisal")
ActiveWorkbook.Sheets("Data").Activate

'Start from the top
Range("A1").Select

Do
If txtPassword.Value = "" Then
Application.ScreenUpdating = True
MsgBox ("That Password was not found. Please try again.")
End
End If

If ActiveCell.Value = txtPassword Then

Application.ScreenUpdating = True

ElseIf ActiveCell.Value = 0 Then
'Go back to the cover sheet
ActiveWorkbook.Sheets("Start").Activate
Application.ScreenUpdating = True
MsgBox ("That Password was not found. Please try again.")

End

'If the entry is nonzero but not found yet, keep looking

ElseIf ActiveCell.Value < txtPassword Then
ActiveCell.Offset(1, 0).Select

End If
Loop Until ActiveCell.Value = txtPassword



Any suggestions will be very welcome!

Regards,
Othello