VBA SaveCopyAs CSV

Sushiboy

New Member
Joined
Jan 18, 2019
Messages
24
I have the following code to which I am trying to SaveAs a copy in a drive as a CSV copy. However, I want to keep the original open as a master template. Basically how do I create a copy and THEN save that copy as a CSV file?

When I run the below code, the macro falls down at FileFormat:=xlCSVWindows. The error message says named argument not found.


Dim Path As String
Dim Filename As String
Dim DateStamp As String


DateStamp = Format(Sheets("DATES").Range("B3"), "yyyymmdd")
Path = "S:\Other\Personal"
Filename = "Prices"

ActiveWorkbook.SaveCopyAs Filename:=Path & Filename & DateStamp &
".csv", FileFormat:=xlCSVWindows
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi,
SaveCopyAs does not have the FileFormat argument. Using this method only allows you to save a file of the same type but with another name.

Use SaveAs Method in your code to change file type

Dave
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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