ExelVBAシートをカンマ区切りCSV形式で保存するマクロ

デスクトップに出力のパターンはこんな感じ

Sub saveAsCSV()

    Application.DisplayAlerts = False

    'デスクトップへ出力
    Dim MyWSH  As Object
    Set MyWSH = CreateObject("WScript.Shell")
    myDeskTopPath = MyWSH.SpecialFolders("Desktop")
    Set MyWSH = Nothing

    Sheets("Sheet1").Copy
    ActiveWorkbook.SaveAs Filename:= myDeskTopPath + "\test.csv", FileFormat:=xlCSV
    ActiveWindow.Close

    Application.DisplayAlerts = True

End Sub

ネタ元