我想根据保存在目录中的最新文档编辑我的链接 . 我正在创建一个仪表板 . 有几个公式附加到不同的文件 . 我想创建一个vba来更新到最新的文件 . 我知道VBA会是一个字符串但是我不确定如何创建它 . 任何所有的帮助都非常感谢 . 我正在使用这个vba,但它不会作为一个函数运行 . 函数LatestReport(Path As String)As String Dim X As Long,FileName As String,FileDate As String,MaxDate As Date,Parts()As String FileName = Dir(Path&IIf(Right(Path,1)= "",“", " \ ") & " .xls ") Do Parts = Split(FileName, " . ") FileDate = Format(Right(Parts(UBound(Parts) - 1), 7), " @@ @@ @@@@ ") If IsDate(FileDate) Then If CDate(FileDate) > MaxDate Then MaxDate = CDate(FileDate) LatestReport = (" G:\ S \ Staffing \ Attendance \ 2016 \“)结束如果结束如果FileName = Dir()循环而Len(FileName)结束函数
1 回答
该函数将识别日期对象和文件名 -
用路径打电话,例如 -