楷字雷州话怎么读:excel问题

来源:百度文库 编辑:高考问答 时间:2024/05/07 18:58:00
在excel中如何用宏命令把某一单元格的内容作为另存为的文件名?
例如把A1的内容作为文件名的宏该怎么做?

Sub Macro1()
Dim aa As String
aa = Range("a1")
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\tiansj\桌面\" + aa + ".xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub