Home |
Search |
Today's Posts |
#2
![]() |
|||
|
|||
![]()
You can protect your code within the VBE via:
tools|vbaproject properties|protection tab Then when your code blows up, the users won't get the debug option. But better would be to catch the password error and code around it: Option Explicit Sub testme() Dim okToContinue As Boolean Dim wkbkName As String Dim wkbk As Workbook wkbkName = "C:\my documents\excel\book1.xls" Set wkbk = Nothing On Error Resume Next Set wkbk = Workbooks.Open(Filename:=wkbkName) On Error GoTo 0 If wkbk Is Nothing Then MsgBox "You didn't open the workbook!" Exit Sub 'or whatever you want End If MsgBox wkbk.FullName End Sub ==== Is there a reason you don't want your macro to supply the password to the second workbook? You could add it on the .open line: Set wkbk = Workbooks.Open(Filename:=wkbkName, Password:="a") H the Layman wrote: I am opening a password protected Excel file from a button assigned with a macro. However, when i press the button all works fine, the password box appears for the file. if i enter the pass the file opens fine. The problem occurs if i cancel the password request. The "debug" box appears and then goes into editor mode. I do not want this to happen as it presents users with an opportunity to hack away at the code!!!! Can I stop this from happening? if so, could somebody please explain how to go about it, in laymans terms.... :) thanks in advance, -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? | Excel Discussion (Misc queries) | |||
How Do I open an excel file without Excel Viewer support | Excel Discussion (Misc queries) | |||
how to turn off email header with excel workbook | Excel Discussion (Misc queries) | |||
Turn off Assistance pane in Excel | Excel Discussion (Misc queries) | |||
Why do formulas turn to values wen copying in Excel 2003... | Excel Worksheet Functions |