Excel for Macbook Pro error

gemini528

Board Regular
Joined
Jun 13, 2013
Messages
53
Hello Excel Gurus,

I have a working macro for Windows but when I bought Macbook Pro and use it, I cannot save it and there is an error when I close and save it. Any help would be appreciated. Please see Macro below.

Thank you.
Gemini528

Code:
Sub FileClose()
 
Dim Backup As String
 
myFlg = True
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.DisplayFormulaBar = True
   
    Backup = "C:\USERS\PTR\DESKTOP\BACKUP\Kaperahan " & Format(Date, "YYYY-MM-DD") & ".xlsb"
  
    If Len(Dir("D:\", vbDirectory)) = 0 Then
       Beep
      MsgBox "Please Insert the USB Drive and Try Again!"
     Exit Sub
    End If
   
    ThisWorkbook.Save
    Application.DisplayAlerts = False
    ThisWorkbook.SaveAs Filename:=Backup
    Application.DisplayAlerts = True
   
      On Error GoTo error_Handler:
   
error_Handler:
Application.Quit
 
Application.ScreenUpdating = True
Application.Quit
 
End Sub
[CODE]
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
The code uses Windows file path conventions. At the least you need to use Application.PathSeparator rather than "/" in your code.
 
Upvote 0
Thanks for your prompt reply, however I an a newbie in Macro, If you do't mind, can you revised the Macro to show the changes.

Again, Thank you so much.
 
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,234
Members
448,951
Latest member
jennlynn

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