Don't know the syntax to get the file name on a Mac, but I'm guessing that you'll need some complier directives


Option Explicit


Dim filepath As String




#If Mac Then






#Else
Sub SelectFile()
    Dim fDialog As FileDialog
    Dim filepath As String
    
    MsgBox "Please select/browse data excel file from your computer! "
    
    Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
    With fDialog
        'Optional: FileDialog properties
        .AllowMultiSelect = False
        .Title = "Select a file"
        .InitialFileName = "C:"
        'Optional: Add filters
        .Filters.Clear
        .Filters.Add "Excel files", "*.xlsx"
        .Filters.Add "All files", "*.*"


        'Show the dialog. -1 means success!
        If .Show = -1 Then filepath = fDialog.SelectedItems(1)
    End With
End Sub


#End If