SaveAs macro

Jmoz092

Board Regular
Joined
Sep 8, 2017
Messages
182
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

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
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,216,765
Messages
6,132,594
Members
449,737
Latest member
naes

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