Workbooks can be locked in a few different ways.
Do you mean that you have:
1. Worksheets that are portected via tools|protection?
2. The workbook is protected via Tools|protection?
3. The workbook is protected from opening via File|saveas|tools|...?
4. The VBA project is protected tools|vbaproject properties?
Each would have a different response.
And you may want to post a little more specifics (not a workbook) just for more
background.
guilhaume wrote:
hi all
I have a lot of excel file to unlock with a VB program
How can I know if a workbook is locked (not to try to treat them when
they are unlocked)
I tried to do:
Dim pass As String
pass= currentWorkbook.Password
If pass < "" Then
unlocking_treatment.....
End If
But even if the workbook is unlocked, the program passes into the If
condition and tries to unlock
While debuging, I saw that pass has the following value: "********"
what can I do?
Guilhaume
--
guilhaume
------------------------------------------------------------------------
guilhaume's Profile: http://www.excelforum.com/member.php...o&userid=12009
View this thread: http://www.excelforum.com/showthread...hreadid=319779
--
Dave Peterson