Consulting

Results 1 to 4 of 4

Thread: Pick a Folder Name in Mac 2011 VBA

  1. #1

    Pick a Folder Name in Mac 2011 VBA

    Hi All.

    Does anyone know if msoFileDialogFolderPicker can be used on a Mac?

    I appreciate any suggestions on this subject.




    Thanks for helping.


    mauryb

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    I'd use this
    [VBA]Dim returnVal As String

    returnVal = MacScript("try" & vbLf & "choose folder" & vbLf & "end try")

    If returnVal = Chr(0) Then
    MsgBox "cancel pressed"
    Else
    MsgBox "folder chosen: " & vbCr & returnVal
    End If[/VBA]

  3. #3
    mikerickson,

    Thank you once again.

    I could not get the macscript to work. No surprise there.
    You may recall I am writing for a Mac on a Pc.

    Your suggestion was still helpful because it did prompt me to look a little more into scripting. I may have been "missing the boat" on this resource.

    Less elegant, what I ended up doing was using the Dir() function to create a list box of folders to pick from in a form.

    Your time and expertise is really appreciated--especially for the tip on Application.PathSeparator. This was a life saver.


    Best,
    mauryb

  4. #4
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Have you tried conditional compiling.
    [VBA]Sub test()
    Dim returnVal As String

    #If Mac Then
    returnVal = MacScript("try" & vbLf & "choose folder" & vbLf & "end try")
    If returnVal = Chr(0) Then returnVal = "False"
    #Else
    Rem code for Windows
    #End If

    If returnVal = "False" Then
    MsgBox "cancel pressed"
    Else
    MsgBox "folder chosen: " & vbCr & vbCr & returnVal
    End If
    End Sub[/VBA]

Posting Permissions

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