-
Help with FileFormat issue
Hi All!
I'm fairly new to VBA and am attempting to just save my file as a csv. Basically I have a workbook that is connected to an XML feed so it updates when I need it to. When I refresh the doc I call my program substitution function(which just does a loop through a column and changes values to something I can import in our CRM so there are matching values). After this is completed, I'd like for the new results to be automatically saved to a csv file for import.
This is the code I currently have set up:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.DisplayAlerts = False
Call ProgramSubstitutions
ActiveWorkbook.SaveCopyAs Filename:="G:\Enroll_Dev\ADMISSIONS AND RECRUITMENT ACTIVITIES\Admissions\Keystone\internationalimports.csv", FileFormat:=xlCSV
End Sub
However everytime I run it I'm getting this error: Compile Error: Named Argument not Found and it's highlighting the FileFormat:=
compileerror.JPG
Ugh what am I doing wrong? I'm assuming it's something super simple and I have looked and looked to see what may be happening but I can't find a solution.
TIA
-
It seems that .SaveCopyAs does not have the same arguments as .SaveAs.
It appears only to have one argument, the filename.
p45cal
Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.
-
... and you can only save a single sheet workbook as a csv.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
A copy is a copy: so a copy of an .xlsb file is an .xlsb file and not a csv-file, nor anything else.
-
Thanks everyone for your input. The reason for using the savecopyas was preventing the original file from closing so I could keep the workbook open (not convert to csv). Now I understand that's not how it works. Is there another way to do this? Save the file as a csv but keep the workbook open? I suppose like exporting the file as CSV.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules