我需要创建一个宏,将打开一个.csv文件,但打开它在记事本(这保留了格式,我需要),然后保存这个打开的记事本作为一个.txt文件。
我现在的代码将根据需要在记事本中打开.csv文件。但我不能保存是作为一个具有相同文件名的.txt文件。
有什么建议吗?
Dim FileName As String
Dim FilePath As String
FileName = "file1"
FilePath = "C:\folder_structure\"
'This opens the .csv file in notepad and works
Shell "notepad.exe " & FilePath & FileName & ".csv", vbNormalFocus
'***** The comments below contain the approaches I have tried but none work *****
'ActiveWorkbook.SaveAs FileName:=FilePath & FileName & ".txt.", FileFormat:=xlCSVWindows
'Application.SaveAs fileName:=FilePath & fileName & ".txt.", FileFormat:=xlCSVWindows
'ActiveDocument.SaveAs fileName:=FilePath & fileName & ".txt.", FileFormat:=xlCSVWindows
'in essense I want this
open notepad .SaveAs FilePath & FileName & ".txt"
字符串
1条答案
按热度按时间yvgpqqbh1#
你可以试试
FileCopy
:字符串