Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 124
  • Last Modified:

Determine if file is read-only?

How can I determine if a file is "Read-only"
Say a file that the user have chosen on the Save Dialog Box. It just gives me an error and period! I want to say it nicely to the user: "Hey man... that's read- only!" :p
Thank you!
1 Solution
Private Sub Command1_Click()
Dim Atr As Integer
Atr = GetAttr(CommonDialog1.FileName) And vbReadOnly
If Atr = 1 Then
    MsgBox "File is Read Only"
End If
End Sub
figjusAuthor Commented:
Just what I needed. Thanks!

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now