VBA Mac Problem with Save Command

Realtreegirl75

New Member
Joined
Aug 28, 2022
Messages
31
Office Version
  1. 365
Platform
  1. Windows
The is the save as code for our company forms and it doesn't seem to work on Mac but it works great on Windows. Since I'd hate to require everyone with a Mac to buy a new computer for this to work, is there a way that I can edit the line of code that is giving everyone problems? As it is, the code will open the save as dialogue box (with the name of the file autopopulated) so that the user can save their file in a location of their choice. If the user clicks save, then the macro continues but if they hit cancel, it exits the sub. I still need this to work this way (there was a lot of lost data before we got this fixed) but I am totally lost when it comes to Macs.

In case it doesn't come through, this is the line that throws a runtime error everytime:
FileSaveName = Application.GetSaveAsFilename(InitialFileName:=tdayName, filefilter:="Excel Files(*.xlsm),*.xlsm", Title:="Please save the file")

VBA Code:
Sub ATMmasterbutton()

Dim tdayName As String
Dim MPID As String
Dim tday As String
Dim inspect As String
Dim tmrName As String
Dim tmr As String
Dim ENO As String
Dim FolderPath1 As String
Dim FolderPath2 As String
Dim FolderPath3 As String

If Val(Application.Version) > 15 Then
    If ActiveWorkbook.AutoSaveOn Then ActiveWorkbook.AutoSaveOn = False
End If

MPID = Range("r3").Text
tday = Range("ac4").Text
inspect = Range("E6").Text
ENO = Range("AC3").Text
tmr = Range("T237").Text
FolderPath1 = Application.ThisWorkbook.Path & "/"
tdayName = "DIR - " & MPID & " - " & tday & " - " & inspect
tmrName = "DIR - " & MPID & " - " & tmr & " - " & inspect
                                
Application.DisplayAlerts = False

FileSaveName = Application.GetSaveAsFilename(InitialFileName:=tdayName, filefilter:="Excel Files(*.xlsm),*.xlsm", Title:="Please save the file")
If FileSaveName = False Then Exit Sub
ThisWorkbook.SaveAs Filename:=FileSaveName, FileFormat:=52

FolderPath2 = Application.ThisWorkbook.Path & "/"

If Val(Application.Version) > 15 Then
    If ActiveWorkbook.AutoSaveOn Then ActiveWorkbook.AutoSaveOn = False
End If

End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,215,679
Messages
6,126,183
Members
449,296
Latest member
tinneytwin

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