保存在当前目录中并与单元格值

时间:2017-06-01 14:51:24

标签: excel vba

当前文件夹位置中的xlsm,并在名称

之前连接单元格值的值

感谢名单

Private Sub CommandButton8_Click()

Dim nom As String
nom = Dir(ThisWorkbook.FullName)
Range("F700").Value = nom
ActiveWorkbook.SaveAs Filename:=Range("G63").Value & "_" & nom
End Sub

1 个答案:

答案 0 :(得分:1)

它应该是这样的。

Sub SaveToRelativePath()
    Dim relativePath As String
    relativePath = ThisWorkbook.Path & "\" & ActiveWorkbook.Name
    ActiveWorkbook.SaveAs Filename:=relativePath
End Sub