|
|

Changing a File from Read-Only to Normal
In some cases (normally when a file is burnt to a CD-ROM) a file may have it's attributes set to include Read-only. One way of avoiding this is to zip the files before copying them to the CD-ROM. Another way is to change the attributes of any files in question once they have been copied to suitable media (such as a hard drive). A sample function is given below:
Public Function fChangeReadOnly(strFolder As String) As Long
On Error GoTo E_Handle
Dim strFile As String
Dim lngFileAttr As Long
If Right(strFolder, 1) <> "\" Then strFolder = strFolder & "\"
strFile = Dir(strFolder, vbReadOnly)
Do While strFile <> ""
lngFileAttr = GetAttr(strFolder & strFile)
If lngFileAttr And vbReadOnly Then
SetAttr (strFolder & strFile), lngFileAttr - vbReadOnly
fChangeReadOnly = fChangeReadOnly + 1
End If
strFile = Dir
Loop
fExit:
On Error Resume Next
Exit Function
E_Handle:
Select Case Err.Number
Case 71
Case 75
Case 76
Case Else
MsgBox Err.Description & vbCrLf & "sChangeReadOnly", vbOKOnly + vbCritical, "Error: " & Err.Number
End Select
Resume fExit
End Function
|
Alternatively, you can change the property manually, by opening Windows Explorer, Right-Clicking on the required file, selecting Properties, and then removing the tick from 'Read-only'.
Top
HOME |
NEW |
TABLES |
QUERIES |
FORMS |
REPORTS |
GENERAL |
API |
DOWNLOADS |
TUTORIAL |
RESOURCES
E-MAIL
Copyright & Disclaimer
|
| |