View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
mccann_mj mccann_mj is offline
external usenet poster
 
Posts: 6
Default VBA in Excel Open properties

Thanks for the info. It worked as I wanted it! (kind of rare for this project)
--
Michael JM


"Matthew Herbert" wrote:

Michael,

The .ReadOnly property should tell you if the file is in a ReadOnly state or
not.

So, your Workbook_Open event could look something like the following:

Private Sub Workbook_Open()
If ThisWorkbook.ReadOnly Then
'add code for the file being in a ReadOnly state
End If
End Sub

Best,

Matthew Herbert

"mccann_mj" wrote:

I have an Excel 2007 file that when opened, asks for a password, but if you
don't have the password, will open as a read only (using the "Save As",
tools, General Options). I have a userform that opens upon opening the
workbook. I'm trying to find a way that if the password is not used, the form
does not open up; if the password is used, the form pops up. Is there an open
property I can "read" to determine if the password was used?

--
Michael JM