Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel中Microsoft Word快速部件的等效功能是什么_Excel - Fatal编程技术网

Excel中Microsoft Word快速部件的等效功能是什么

Excel中Microsoft Word快速部件的等效功能是什么,excel,Excel,我想在excel的单元格中自动显示“上次保存日期”。编写VBA代码可能不可行,因为创建excel工作表的人员可能不熟悉编写VBA代码。如果您将此代码打包为外接程序,他们就不必编写此代码,但您/他们必须使用宏,没有其他方法可以这样做 Public Function LastSaveTime() As Variant Dim fs, f Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFile

我想在excel的单元格中自动显示“上次保存日期”。编写VBA代码可能不可行,因为创建excel工作表的人员可能不熟悉编写VBA代码。

如果您将此代码打包为外接程序,他们就不必编写此代码,但您/他们必须使用宏,没有其他方法可以这样做

Public Function LastSaveTime() As Variant
    Dim fs, f
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(ActiveWorkbook.FullName)
    'you can delete the debug.print, it's just for debug ;)
    Debug.Print "Modified: " & f.DateLastModified
    LastSaveTime = f.DateLastModified
End Function
改编自excel帮助,查找DateLastModified

将其保存在模块中,然后按照“作为外接程序分发”-howto

现在,如果我没有犯任何基本错误,这将为任何工作簿提供一个新的工作表函数
=LastSaveTime()
,该函数返回活动工作簿的datelastmedited。由于activeworkbook,可能会出现一个问题—当将其用作外接程序时,使用
应用程序.caller
构造可能是一种节省