+ Reply to Thread
Results 1 to 4 of 4

MacScript for Selecting a Folder doesn't return the path of the selected folder

  1. #1
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    MacScript for Selecting a Folder doesn't return the path of the selected folder

    I'm helping someone with a workbook that should run on both PC as well as Mac.
    And of course there is a tiny issue with that

    I've written a function SelectFolder() that should serve both Mac and PC:
    Please Login or Register  to view this content.
    As I don't have a Mac myself it's hard to debug this. Maybe someone with a Mac can help me out here.

    I'm attaching a sample file with the function in it. Sheet1 has "button" [SelectFolder]. Clicking it should bring up Finder.

    EDIT:
    the problem seems to be with setting an initial folder path.
    Uploaded a updated test workbook with a function taking the initial folder as an optional parameter.
    Also updated the code above.
    Attached Files Attached Files
    Last edited by Tsjallie; 01-05-2020 at 05:53 PM.
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: MacScript for Selecting a Folder doesn't return the path of the selected folder

    It works for me and returns the selected path.
    Rory

  3. #3
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: MacScript for Selecting a Folder doesn't return the path of the selected folder

    Hi Rory. Thx for replying.
    It seems that with the desktop folder MacScript correctly returns the selected folder path.
    But if a specific folder is issued with the parameter it doesn't.
    So most likely there's something wrong with the syntax of the folder path coming with the parameter, causing the macscript running into some error and breaking.
    Could you check on that, pls.

  4. #4
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: MacScript for Selecting a Folder doesn't return the path of the selected folder

    Finally solved this problem.
    For anyone facing the same problem here is the solution.

    The culprit is in this code line:
    Please Login or Register  to view this content.
    This variable contained a Posix path (with a slash as separator), but Macscript expects a Mac path (with a colon as separator).
    So e.g. "/users/Tsjallie/" should be "Macintosh HD:users:Tsjallie:"

    Solution is to convert the Posix path to a Mac path with these code lines:
    Please Login or Register  to view this content.
    For the enthousiasts I'm attaching a workbook with a SelectFolder-fuction which should work on both Mac as well as PC.
    Attached Files Attached Files

+ 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. Error in mailing of a file as attachment in my selected folder path
    By Vcare in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-29-2017, 07:33 AM
  2. [Path location and Document macro]Require File , Folder and sub-folder path creator macro
    By Nitish Shrestha in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2017, 02:23 AM
  3. Replies: 2
    Last Post: 12-29-2015, 04:19 AM
  4. [SOLVED] Help with Macro to find full path of Folder, using input of first 4 chars of folder name
    By Anxiety in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2015, 09:02 AM
  5. Open Folder (Prompt User for final folder name in location path)
    By synergeticink in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2014, 03:33 PM
  6. Code to list the folder path and sub folder path of a specific file
    By kalai1587 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2013, 03:51 AM
  7. Replies: 6
    Last Post: 08-11-2006, 03:41 PM

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