Chris M
Chris M

Reputation: 23

Save As Macro working on PC but results in error on MAC

I have an excel macro which I use to strip formulas / delete sheets from a workbook, then open a save as dialog box with the desired file name pre-populated - this works fine on PC but falls over on MAC - relevant code below - the macro fails at .InitialFileName = FileName when run on a MAC Any ideas how to resolve? Many thanks Chris

Dim FileName As String
FileName = Range("A1").Text & " " & Format(Date, "DDMMYY")
Application.DisplayAlerts = False


Dim fPth As Object
Set fPth = Application.FileDialog(msoFileDialogSaveAs)


With fPth
.InitialFileName = FileName
.Title = "Save your File"
.FilterIndex = 1
.InitialView = msoFileDialogViewList
If .Show <> 0 Then
ThisWorkbook.SaveAs FileName:=.SelectedItems(1), FileFormat:=xlOpenXMLWorkbook
End If
End With
Application.DisplayAlerts = True
End Sub

Run time 91 error code..........

Upvotes: 0

Views: 58

Answers (0)

Related Questions