VBA - 如何从excel 2007中最近的文档列表中删除文件? [英] VBA - How do I remove a file from the recent documents list in excel 2007?

查看:123
本文介绍了VBA - 如何从excel 2007中最近的文档列表中删除文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Office中最近的文档功能非常有用,但是我将文件移动到一个新目录,现在我打开工作簿时,无法让Excel停止点击无法找到该文件通知。 Excel选项似乎只能控制这些近期文档中显示的数量,而不是实际保存的数量。所以我想知道在VBA中有没有办法得到列表并删除违规文件。

The recent documents feature in Office is really useful, but I moved a file to a new directory and now I can't get Excel to stop hitting me with a "can't find this file" notification whenever I open a workbook. The Excel options seem only to control how many of these "recent documents" are displayed and not how many are actually saved. So I;'m wondering if there's a way in VBA to get at the list and remove the offending file.

推荐答案

尝试这个...

Public Function TestIt()
    For i = 1 To Application.RecentFiles.Count - 1
        Dim answer As String
        answer = MsgBox("Delete " & Application.RecentFiles(i).Name, vbYesNo)

        If answer = vbYes Then
            answer = MsgBox("Are you sure?", vbYesNo)
            If answer = vbYes Then
                Application.RecentFiles(i).Delete
            End If
        End If
    Next i
End Function

这篇关于VBA - 如何从excel 2007中最近的文档列表中删除文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆