从Outlook 2007升级到2010&出现错误 [英] Upgraded from Outlook 2007 to 2010 & am getting an error

查看:175
本文介绍了从Outlook 2007升级到2010&出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个小程序可以检查我的E:Mails&将它们移动到特定的文件夹,但是升级到Outlook 2010后,它将不再起作用.我以为我可能需要添加参考(如何分辨一个?!?),但是我发现一个博客建议这可能是由于Outlook 2010工作方式的改变.我无论如何都不是VBA的专家,所以如果有人可以帮助我,我将不胜感激.

这是代码...

Hi there, I have a small program that checks my E:Mails & moves them to specific folders, but after an upgrade to Outlook 2010 it no longer works. I thought I probably needed to add a Reference (how do you tell which one ?!?) but I found a Blog suggesting that this may be due to a change in the way Outlook 2010 works. I am not an expert in VBA by any means, so if somebody could help I would appreciate it immensely.

This is the code ...

Function OpenMAPIFolder(szPath) 
     
     'Pass a parameter to this module, in the following  format, to set the rightmost Folder
     'as the object, or live, Folder ... "\Gary\Kickabout\Attachments"
     
    Dim app, ns, flr, szDir, i 
    Set flr = Nothing 
    Set app = CreateObject("Outlook.Application") 
    If Left(szPath, Len("\")) = "\" Then 
        szPath = Mid(szPath, Len("\") + 1) 
    Else 
        Set flr = app.ActiveExplorer.CurrentFolder 
    End If 
    While szPath <> "" 
        i = InStr(szPath, "\") 
        If i Then 
            szDir = Left(szPath, i - 1) 
            szPath = Mid(szPath, i + Len("\")) 
        Else 
            szDir = szPath 
            szPath = "" 
        End If 
        If IsNothing(flr) Then 
            Set ns = app.GetNamespace("MAPI") 
            Set flr = ns.Folders(szDir) <<< The Error occurs on this line 
        Else 
            Set flr = flr.Folders(szDir) 
        End If 
    Wend 
    Set OpenMAPIFolder = flr 
End Function



...这就是错误...

运行时错误" -2147221233(8004010f)":

尝试的操作失败.找不到对象."



... and this is the Error ...

"Run Time Error ''-2147221233 (8004010f)'':

The attempted operation failed. An object could not be found."

推荐答案

您可能想先运行SCANPST
You may want to run SCANPST first


此代码在Outlook 2010中有效. ..

http://msdn.microsoft.com/en-us/library/office/ff868990.aspx [^ ]
This code works in Outlook 2010 ...

http://msdn.microsoft.com/en-us/library/office/ff868990.aspx[^]


这篇关于从Outlook 2007升级到2010&amp;出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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