我正在尝试对宏进行编码,以便在关闭文档之前将最后修改的日期放入excel单元格中。
这是我的代码:
Private1
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Range ("A1" = ThisWorkbook.BuiltinDocumentProperties("Last Save Time"))
End Sub
出现错误:外部程序无效。
请帮我解决这个问题。 谢谢。
答案 0 :(得分:2)
而不是
Private1
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Range ("A1" = ThisWorkbook.BuiltinDocumentProperties("Last Save Time"))
End Sub
使用
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Range("A1") = ThisWorkbook.BuiltinDocumentProperties("Last Save Time")
End Sub