VBA:仅选择特定列以另存为.txt文件

时间:2018-06-19 17:34:49

标签: excel vba excel-vba

我目前有以下代码将电子表格另存为.txt文件。

Sub Macro1()

    'Saves the Activesheet to the Desktop as a text file with a different extension
    Dim newFile As String, fName As String, gName, fileSaveName

    gName = "FGM_"
    fName = Range("A2").Value

    newFile = gName & " " & fName & " " & Format$(Date, "dd-mm-yyyy")
    fileSaveName = Application.GetSaveAsFilename(newFile, "Text (MS-DOS) (*.txt), *.txt")

    ThisWorkbook.SaveAs fileSaveName, xlTextMSDOS

End Sub

但是,我只想保存个特定列,并将它们转换为.txt文件。

0 个答案:

没有答案