View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Incidental Incidental is offline
external usenet poster
 
Posts: 226
Default Testing for "Password to modify"

Hey there

You could incorporate this snippet of code that was a reply by Thom
Ogilvy to a question similar to your own.

S


This is tested and works in Excel:

Sub AAATEst()
Dim wkbk As Workbook
On Error Resume Next
Set wkbk = Workbooks.Open("C:\Data6\AAABook.xls", _
Password:="", WriteResPassword:="")
On Error GoTo 0
If wkbk Is Nothing Then
MsgBox "Has Password"
End If
End Sub


It will open a workbook that is not password protected.


don't know if it will work for .Net.


--
Regards,
Tom Ogilvy