Realtreegirl75
New Member
- Joined
- Aug 28, 2022
- Messages
- 40
- Office Version
- 365
- Platform
- 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")
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