setattr

Y

Yngve

Hi
Is it posible to open a file and us
sub auto_open and check if file is vbReadOnly, change it if I`m the
right user.

Regards Yngve
 
Y

Yngve

After you write the macro you need to protect the macro so nobody
changes the code or will be able to read your password

Something like this

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
If Environ("UserName") = "XXX" Then
If Wb.HasPassword = True Then
Wb.Unprotect "Password"
End If
End If
End Sub

the username is you PC login name

--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread:http://www.thecodecage.com/forumz/showthread.php?t=161054

Microsoft Office Help

Hi Joel
Thanks

Regards Yngve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

transpose 1
Removing Objects 1
Auto_Open Workbook_Open 4
Run Macro 3
SaveAs Crashes 2
Cannot save macro spreadsheet due to ReadOnly = True 1
Close an Excel file if is found it open. 13
Form Security 2

Top