+ Reply to Thread
Results 1 to 5 of 5

Open file macro allowing multiple users to run macro

  1. #1
    Registered User
    Join Date
    12-06-2021
    Location
    Scotland
    MS-Off Ver
    365 (Mac)
    Posts
    9

    Open file macro allowing multiple users to run macro

    Hi,

    I have a macro that goes into a file, copies a range and pastes that range in a different file. I have managed to get it to work for me but can't figure out how to get it to work from any other computer.
    The file is saved on Dropbox with the same folder structure for all of the users who might be running the macro.

    The code I have currently for opening the file is:

    Please Login or Register  to view this content.
    from searching on various sites I understand I have to use code along the lines of:

    Please Login or Register  to view this content.

    However, I haven't managed to work this code into what I already have without it causing an error.

    Any help is greatly appreciated!




    Also, is the file & folder name considered case sensitive when referencing in VBA?
    e.g. when looking at the above code, if the folder name was "18 australia south east" but the code refers to "18 Australia South East" would the code still work or not?

    Thanks!
    Last edited by 6StringJazzer; 12-07-2021 at 11:46 AM. Reason: please use CODE tags

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,701

    Re: Open file macro allowing multiple users to run macro

    You are almost there.
    Please Login or Register  to view this content.
    Folder and file names in Windows are not case sensitive, so you don't have to worry about case in VBA (or any other language).

    (You are assuming that everybody uses the default path when they install Dropbox. This is a pretty safe bet but not 100% guaranteed. If you want a guarantee you have to read the Dropbox JSON file that gives the configuration details.)

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,701

    Re: Open file macro allowing multiple users to run macro

    Just for the sake of completeness, here is the code to find the Dropbox path. This is 100% guaranteed, unless the user has multiple Dropbox accounts installed to the same machine. If there are multiple accounts it uses the last one.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-06-2021
    Location
    Scotland
    MS-Off Ver
    365 (Mac)
    Posts
    9

    Re: Open file macro allowing multiple users to run macro

    Perfect thanks!
    I should have mentioned I am actually working on mac so Environ didn't work for me but the help you provided allowed me to understand what the code is doing so I was able to manipulate it to work on mac.
    Being relatively new to coding, it feels great when you are able to understand what the code is actually doing.

    Thanks again for your assistance!



    For others who may have the same issues, this worked for me (no promises that it is the most efficient way but it works!):

    Please Login or Register  to view this content.

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,701

    Re: Open file macro allowing multiple users to run macro

    Quote Originally Posted by MBel1 View Post
    I am actually working on mac
    You should specify this in the Excel version in your profile.

    The file separator on a Mac is ":" so I don't know how you get that path to work.

    Also, for code that has to run in both environments you can use Application.PathSeparator instead of hardcoding "\".

+ 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. Macro for allowing access for users to click buttons when sheet is protected
    By targus92 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2016, 12:29 PM
  2. Macro to save an excel file (that is not the activesheet) to PDF / multiple users
    By Mdelgado in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2013, 12:46 AM
  3. Macro to capture IP address of all users who open the file
    By bodhanwala in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-15-2012, 08:58 AM
  4. Allowing users to select the range for a macro to be run on
    By H&MITGuy in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-13-2009, 12:03 PM
  5. Allowing other users to use Workbook created with Macros without enabling Macro
    By jlcford in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-07-2008, 03:10 PM
  6. not allowing a file to open if macro's are disabled!?
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2005, 11:05 AM
  7. Replies: 1
    Last Post: 02-18-2005, 10:06 AM

Tags for this Thread

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