Multiple Files Access in Mac Office VBA

Multiple Files Access in Mac Office VBA

GrantAccessToMultipleFiles

Similar to Office for windows VBA in Office for Mac doesn’t allow access to external files by default. Since Office Mac 2016 is a Sendbox development hence user need to use GrantAccessToMultipleFiles command to gain access over multiple files which takes an array of file paths as given below:

Syntax

Boolean  GrantAccessToMultipleFiles(filePathArray)

Code example

Sub getFileAccess() 

    'Declare Variables 
    Dim oAccessGranted As Boolean
    Dim oPermissionCandidates 

    'Create an array with file paths for the permissions that are needed.
    oPermissionCandidates = Array("/Users//Desktop/file1.txt", "/Users//Desktop/file2.txt") 

    'Request access from user.
    oAccessGranted = GrantAccessToMultipleFiles(oPermissionCandidates) 
    'Returns true if access is granted; otherwise, false. 
End Sub

Above script helps user to get access over multiple files using single command in Office for Mac

Leave a Reply

Your email address will not be published. Required fields are marked *