VBA SaveCopyAs CSV

Sushiboy

New Member
Joined
Jan 18, 2019
Messages
21
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
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

dmt32

Well-known Member
Joined
Jul 3, 2012
Messages
6,085
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
 

Watch MrExcel Video

Forum statistics

Threads
1,108,954
Messages
5,525,880
Members
409,669
Latest member
JDCupps

This Week's Hot Topics

Top