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

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,980
The code uses Windows file path conventions. At the least you need to use Application.PathSeparator rather than "/" in your code.
 

gemini528

Board Regular
Joined
Jun 13, 2013
Messages
53
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,467
Messages
5,636,456
Members
416,919
Latest member
twc2c

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
Top