如何使用 VBA 在 SharePoint 中获取文件的上次修改日期?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28020560/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 05:52:36  来源:igfitidea点击:

How will I get the last modified date of a file in a SharePoint using VBA?

excelvbaexcel-vbasharepointsharepoint-2013

提问by xtina1231

I would like to seek help regarding on getting the last modified date of a file in a Sharepoint. What VBA code/command will I use in order to execute it. I would like to show this "Last Modified Date" of the file in a MsgBox when a command button is clicked.

我想寻求有关获取 Sharepoint 中文件的最后修改日期的帮助。我将使用什么 VBA 代码/命令来执行它。单击命令按钮时,我想在 MsgBox 中显示文件的“上次修改日期”。

Your prompt response is very much appreciated.

非常感谢您的及时回复。

回答by Docta001

This one had me scratching my head for a bit too...

这个也让我摸不着头脑...

Make sure to add "@ssl" following the root URL e.g

确保在根 URL 后添加“@ssl”,例如

FileDateTime("\\site.com@ssl\file.xlsx")

FileDateTime("\\site.com@ssl\file.xlsx")

回答by Kaustav Banerjee

You can use

您可以使用

FileDateTime ( file_path )

to get the date and time of when a file was created or last modified.

获取文件创建或上次修改的日期和时间。

For more information please visit the below link..

欲了解更多信息,请访问以下链接..

VBA Help

VBA 帮助

回答by Ryan Kok

I've been trying to figure this out for a while and I stumbled upon something in another line of inquiry that led me to a solution.

我一直在尝试解决这个问题,并且在另一条查询线中偶然发现了一些问题,这使我找到了解决方案。

In your VBA window, go to Tools -> References, and then scroll down and check the box next to "Microsoft Scripting Runtime".

在您的 VBA 窗口中,转到“工具”->“参考”,然后向下滚动并选中“Microsoft Scripting Runtime”旁边的框。

Then when you specify your link it's going to read like this:

然后,当您指定链接时,它将如下所示:

FileDateTime("//site.com/page/file.xlsx").

FileDateTime("//site.com/page/file.xlsx”)。

No "http:" Once I did that, it worked like a charm.

没有“http:”一旦我这样做了,它就像一个魅力。