SaveAs macro

Jmoz092

Board Regular
Joined
Sep 8, 2017
Messages
184
Office Version
  1. 365
  2. 2011
Platform
  1. Windows
  2. MacOS
Hi, I'm getting an error when calling a SaveAs sub at the end of another macro. The save as is not executing, but I've had success using a similar code before. Is there anything obvious wrong with how the code is written? I've made sure that the network files path names are correct in the code and on the network.

Thanks.

Code:
Sub saveas()


Dim thisfile As String
Dim FilePth As String


' For Mac
If Application.PathSeparator = ":" Then
    FilePth = "data:Administration:Cath_Lab:" & Range("S2").Value & ":"
    thisfile = Range("R2").Value
    ThisWorkbook.saveas FilePth & thisfile, FileFormat:=53
    
    Else
    ' For Windows
    FilePth = "data\Administration\CATH_LAB\" & Range("S2").Value & "\"
    thisfile = Range("R2").Value
    ThisWorkbook.saveas FilePth & thisfile, FileFormat:=52
    End If
End Sub
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
I am not familiar with MAC syntax, but for PC the path would need to identify the dive, eg. "C:\..."
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

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