通过Excel VBA在Outlook收件箱中进行搜索

时间:2016-03-17 18:27:57

标签: excel vba outlook-vba

尝试运行我的代码时出现运行时错误:我基本上试图单击excel文件中的按钮,然后在我的收件箱中搜索&#34;代理作业&#34;。< / p>

Dim OutApp As Object
Dim OutSearch As Object
Set OutApp = CreateObject("Outlook.Application")
Dim fldr As String
Dim subjekt As String
fldr = "Inbox"
subjekt = "Acting Assignment"
Set OutSearch = OutApp.Advancedsearch(fldr, subjekt, "True", "My search")
Set OutMail = Nothing
Set OutApp = Nothing

End Sub

我在设置的OutSearch行上收到以下错误。如何修复此代码以运行搜索?谢谢你的帮助。 error

1 个答案:

答案 0 :(得分:0)

尝试格式化搜索过滤器,如下所示:

private void tabControl1_MouseDown(object sender, MouseEventArgs e)
{
    Rectangle r = tabControl1.GetTabRect(this.tabControl1.SelectedIndex);
    Rectangle closeButton = new Rectangle(r.Right - 15, r.Top + 4, 9, 7);
    if (closeButton.Contains(e.Location))
    {
        this.tabControl1.TabPages.Remove(this.tabControl1.SelectedTab); 
    }
}