我正在尝试将此代码保存到打开文件的目录中。目前它设法通过 cel 文本保存文件,但默认情况下希望保存在 c:/my 文档中。
这是我到目前为止所拥有的,不知道在哪里添加 ThisWorkbook.Path
Sub Save()
Dim flToSave As Variant
Dim flName As String
Dim flFormat As Long
flFormat = ActiveWorkbook.FileFormat
flName = Range("A1") & Range("A2").Text
flToSave = Application.GetSaveAsFilename _
(flName, filefilter:="Excel Files (*.xlsm), *.xlsm", _
Title:="Save FileAs...")
If flToSave = False Then
Exit Sub
Else
Thisworkbook.SaveAs Filename:=flToSave, FileFormat:=flFormat
End If
End Sub