Change VBA to export data as CSV

PaulaGon

New Member
Joined
Jan 31, 2017
Messages
16
Hello,


I have a table that I need to export and save as a CVS file.
Initially I had a code to export and save the table as a new excel file, with an specific name, but now I need to save data to csv format.
I already tried but I was not able to change the vba code…

Code:
Sub NewFILE()
Application.EnableEvents = False
    Folha1.Range("B15:D" & Folha1.UsedRange.Columns(1).Find("*", , xlValues, , , xlPrevious).Row).Copy
    Workbooks.Add
    ActiveSheet.Name = Folha1.[C4].Text
    [A1].PasteSpecial xlPasteValues
    [A1].PasteSpecial xlPasteFormats
    [A1].PasteSpecial xlPasteColumnWidths
    [A1].Select
    Application.CutCopyMode = False
    Application.Dialogs(xlDialogSaveAs).Show Folha1.Range("C4")
    Application.EnableEvents = True
End Sub



Any suggestions would be greatly appreciated!


Thank you in advanced.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hello welshgasman,


Thank you for your quick reply...


I tryed to change the code looking to the examples of the link you sent me but i was not able correct the vba code..


PG
 
Upvote 0
I would just switch on the macro recorder, then go through the steps required, if I did not have anything to hand.

FWIW in one of my workbooks I have

Code:
' Save the CSV version
ActiveWorkbook.SaveAs Filename:=strOutFile, FileFormat:=xlCSV, _
    CreateBackup:=False

HTH
 
Upvote 0
Hello welshgasman,

I already had tried to switch on the macro recorder and change the steps in the original code.... but I was not able to change the vba code…

Thank you for the help.

I inform I am doing cross-post:https: //www.excelforum.com/excel-programming-vba-macros/1254321-change-vba-to-export-data-as-csv.html
 
Upvote 0
Hello,


I want to inform that I will be no longer monitoring this thread
But I want to thank you for all the help related to this topic!!!


Best regards,
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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