Excel VBA 保存Sheet的问题求助
下面这段代码在Excel 2003报错,调试为红色字段语法报错runtime error 1004:
sub FileSaveAS(wsFullFileName As String)
On Error GoTo FASSerror
' Save file as Tab-Delimited file
Application.ActiveSheet.SaveAs FileName:=wsFullFileName, _
FileFormat:=xlTextWindows, _
CreateBackup:=FalseExit Sub
FASSerror:
MsgBox "Error saving Output data file: " & Err & " " & Err.Description
End Sub
答案或建议:
saveas是workbook的成员方法,不是sheet的。用activesheet.parent.saveas试试,或者activeworkbook.saveas也行。
-------
问题解决了,
首先应该用activeworkbook而不是activesheet;
其次要把fileformat:=xltextwindows改为fileformat:=xltext
文章链接:http://www.baikewenda.com/h/1012/a36935.html