View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jmoffat[_28_] jmoffat[_28_] is offline
external usenet poster
 
Posts: 1
Default closing the active workbook


Hi

I am trying to write some code that when the workbook is opened, it
prompts the user for a password and if an invalid password is entered
it closes the workbook.

This seems pretty simple. Putting the below snippet into the open
event ...

pass_dpanel.Show
If (pass_dpanel.TextBox1.Value < "correct") Then
' not valid password
MsgBox ("invalid password")
ActiveWorkbook.Close
End If

Which works ok until I copy the workbook onto our web server. This
time when an incrrect password is entered a duplicate file is opened
myworkbook[1].xls and if an incorrecte passwrod is entered for a
seccond time I get an "Invalid operation" error.

Any ideas ?


--
jmoffat
------------------------------------------------------------------------
jmoffat's Profile: http://www.excelforum.com/member.php...fo&userid=1151
View this thread: http://www.excelforum.com/showthread...hreadid=535477