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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

dmt32

Well-known Member
Joined
Jul 3, 2012
Messages
7,309
Office Version
  1. 2019
Platform
  1. Windows
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,487
Messages
5,831,975
Members
430,099
Latest member
rdhoy

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