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
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
any helps much appreciated !
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 !