Exporting As CSV

NeedsHelp2

New Member
Joined
Nov 20, 2005
Messages
22
I've managed to find out how to export a worksheet as an excel file by searching past posts. What I would like to do is save it as either a CSV or text file. Despite having tried numeous ways I've failed and am once again seeking assistance.

This is the code that I'm currently using which allows you to save to your chosed directory:

Code:
    Dim MyName As String
    Dim LastRow As Long
    Dim MyFileName As String
    '==================Other Code
    Dim otlApp As Object, otlNewMail As Object
    Dim FileName As String, FSave, FName As String
    MyName = Format(Date, "yy mm dd") ' & ".xls"
    FSave = Application.GetSaveAsFilename(InitialFileName:=Sheets("sheet1").Range("D3").Value & " Backup " & MyName)
    If TypeName(FSave) = "Boolean" Then Exit Sub
    If Mid$(FSave, Len(FSave), 1) = "." Then
        FSave = Mid$(FSave, 1, (Len(FSave) - 1))
        End If
    FName = Right(FSave, Len(FSave) - InStrRev(FSave, "\"))
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Watch MrExcel Video

Forum statistics

Threads
1,119,265
Messages
5,577,088
Members
412,764
Latest member
Brawler
Top