+ Reply to Thread
Results 1 to 7 of 7

Using GrantAccessToMultipleFiles to avoid multiple demands for permissions

  1. #1
    Registered User
    Join Date
    09-25-2019
    Location
    Rixensart, Belgium
    MS-Off Ver
    Excel 2019 for Mac, Version 16.68 and VBA for Apps 7.1
    Posts
    17

    Using GrantAccessToMultipleFiles to avoid multiple demands for permissions

    Hello,

    I have a VBA macro which consolidates data from multiple files.
    Each time I run the macro, the input files are different.
    So, I am annoyed by the "Grant Permissions" request that appears for every file, during each execution of my macro.

    I believe it is possible to grant permissions for all files at once using GrantAccessToMultipleFiles.
    However, after including GrantAccessToMultipleFiles at the start of my macro, it appears to do nothing and I still have to grant access to every file individually, during the execution of the macro.

    Here is an example of what I am trying (or course, there are a lot more files in the actual code):


    Please Login or Register  to view this content.

    Any ideas why it seems to do nothing?
    If I ever get this working, I would also like to have it work with a wild card for all files in a certain folder, for example:


    Please Login or Register  to view this content.

    Any thoughts if that is the best approach?

    Thanks.
    Last edited by Colin_in_Belgium; 10-15-2019 at 02:19 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Using GrantAccessToMultipleFiles to avoid multiple demands fro permissions

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I did it for you this time. Please read forum rules. Thanks

  3. #3
    Registered User
    Join Date
    09-25-2019
    Location
    Rixensart, Belgium
    MS-Off Ver
    Excel 2019 for Mac, Version 16.68 and VBA for Apps 7.1
    Posts
    17

    Re: Using GrantAccessToMultipleFiles to avoid multiple demands fro permissions

    Thanks for modifying.

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Using GrantAccessToMultipleFiles to avoid multiple demands fro permissions

    Quote Originally Posted by Colin_in_Belgium View Post
    Hello,

    Please Login or Register  to view this content.

    Any ideas why it seems to do nothing?
    If I ever get this working, I would also like to have it work with a wild card for all files in a certain folder, for example:


    Please Login or Register  to view this content.
    You could try:

    Please Login or Register  to view this content.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  5. #5
    Registered User
    Join Date
    09-25-2019
    Location
    Rixensart, Belgium
    MS-Off Ver
    Excel 2019 for Mac, Version 16.68 and VBA for Apps 7.1
    Posts
    17

    Re: Using GrantAccessToMultipleFiles to avoid multiple demands fro permissions

    Thanks for your suggestion Winon.
    Unfortunately, I am still being asked to grant access for each file I open.

    (By the way, there was a typo in my original post ...
    I am using the correct file extension .xlsx in the macro and not .xlxs as I had previously put.
    I have now corrected this in my original post.)
    Last edited by Colin_in_Belgium; 10-13-2019 at 01:34 AM.

  6. #6
    Registered User
    Join Date
    09-25-2019
    Location
    Rixensart, Belgium
    MS-Off Ver
    Excel 2019 for Mac, Version 16.68 and VBA for Apps 7.1
    Posts
    17

    Re: Using GrantAccessToMultipleFiles to avoid multiple demands for permissions

    Oh dear ... can nobody share a successful way to do this on Excel 2019 for Mac - to grant access to multiple files in one go?
    It would seem that the sandboxing approach of Excel has caused several related problems.

  7. #7
    Registered User
    Join Date
    09-25-2019
    Location
    Rixensart, Belgium
    MS-Off Ver
    Excel 2019 for Mac, Version 16.68 and VBA for Apps 7.1
    Posts
    17

    Re: Using GrantAccessToMultipleFiles to avoid multiple demands for permissions

    After further experimentation, I notice that if I specify a list of exact filenames in quotes for the file array, then the command works as expected.

    However, if I include a wildcard (*) in the filename, it does nothing.
    Has anyone got this working with a wildcard on Excel for Mac? Thanks.

    This works:
    Please Login or Register  to view this content.
    This doesn't work:
    Please Login or Register  to view this content.
    I have managed to find a workaround that specifies the current date prefix I need included in the filenames, but it's not ideal:
    Please Login or Register  to view this content.
    This is what I would like to get working:
    Please Login or Register  to view this content.
    Last edited by Colin_in_Belgium; 10-16-2019 at 02:57 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Outlook 2010 - 1 Shared Calendar - Multiple Appointment Permissions?
    By shauneyd in forum Outlook Formatting & Functions
    Replies: 1
    Last Post: 04-14-2018, 09:51 AM
  2. Find value based on specific text demands
    By smide in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2017, 08:18 AM
  3. Meeting the Demands of the Man!
    By AdamSmellie in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 01-28-2013, 07:10 PM
  4. [SOLVED] Copy cell if certain demands are met [Solved]
    By paljako in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-06-2012, 10:35 AM
  5. multiple users with different permissions
    By fau5tu5 in forum Excel General
    Replies: 0
    Last Post: 02-24-2010, 10:05 PM
  6. Macro to set range permissions across multiple sheets
    By jamesmbrannan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2010, 05:46 AM
  7. Copying a cell demands a password.
    By Richard Buttrey in forum Excel General
    Replies: 3
    Last Post: 12-05-2009, 11:52 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1