AnsweredAssumed Answered

api to ignore read only document

Question asked by P. Farnham on Jul 14, 2015
Latest reply on Jul 14, 2015 by P. Farnham


I have this piece of code that updates my files is a chosen folder, but ignores read only files by not opening then. (in bold) (file Attributes set as read only)


When I am logged into the vault, files that I don't own are shown as read only at the top of the Solidworks interface (when opened), but these files still open as the file attributes in the folder are not set to read only.


Is there some code that will see that I don't own a file and skip that file if Solidworks states it is read only?


Many thanks




Sub ProcessFolder(myFolder As String)

    Dim myFold As Folder

    Dim fso As New Scripting.FileSystemObject

    Dim myFile As File

    Dim myType As Long

    Dim myFileName As String

    Dim mySubFold As Folder

   Dim myAtt As Long


    Set myFold = fso.GetFolder(myFolder)


    For Each myFile In myFold.Files

        myFileName = myFile.Path

       myAtt = myFile.Attributes

        If myAtt And 1 Then GoTo Skip2 'readonly file