porting windows specific macro to run on mac excel 2011

pudle

New Member
Joined
Jul 19, 2012
Messages
8
ive recently changed from a pc to a mac, i run quite allot of a macros and 99% of them are running fine, but i have one that basicly runs a set of other macros across all the workbooks in a file.

The problem im having is it keep finding an error on this line
Code:
<code>msoFileDialogViewList) As String
</code>

i presume thats because 'mso' is microsoft specific ? When i try and run the full macro (see bellow post) i get this error "compile error: variable not defined"

i wander if any one could help me with porting this macro over to run on mac. for background it was built on excel 2007 windows and im trying to run in on excel mac 2011

Code:
<code>Option Explicit

Function GetFolder(Optional strPath As String) As String
Dim fldr As FileDialog
Dim sItem As String
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
    .Title = "Select a Folder"
    .AllowMultiSelect = False
     If Not IsEmpty(strPath) Then
        .InitialFileName = strPath
    End If
    If .Show <> -1 Then GoTo NextCode
    sItem = .SelectedItems(1)
End With
NextCode:
 GetFolder = sItem
Set fldr = Nothing
End Function

Private Sub test()
Dim v As Variant

'V = GetFolder()
v = BrowseFolder("Select folder")
End Sub

Function BrowseFolder(Title As String, _
        Optional InitialFolder As String = vbNullString, _
        Optional InitialView As Office.MsoFileDialogView = _
            msoFileDialogViewList) As String
    Dim v As Variant
    Dim InitFolder As String
    With Application.FileDialog(msoFileDialogFolderPicker)
        .Title = Title
        .InitialView = InitialView
        If Len(InitialFolder) > 0 Then
            If Dir(InitialFolder, vbDirectory) <> vbNullString Then
                InitFolder = InitialFolder
                If Right(InitFolder, 1) <> "\" Then
                    InitFolder = InitFolder & "\"
                End If
                .InitialFileName = InitFolder
            End If
        End If
        .Show
        On Error Resume Next
            Err.Clear
            v = .SelectedItems(1)
            If Err.Number <> 0 Then
                v = vbNullString
            End If
        End With
    BrowseFolder = CStr(v)
End Function
</code>

any helps much appreciated !
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,214,601
Messages
6,120,462
Members
448,965
Latest member
grijken

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top