Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / March 2008

Tip: Looking for answers? Try searching our database.

Problems accessing named folder from VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rob - 29 Feb 2008 15:50 GMT
I have a VBA macro that includes the lines

   Dim olNS As Outlook.NameSpace
   Dim TopFolder As Outlook.MAPIFolder

   Set olNS = Application.GetNamespace("MAPI")
...
   Set TopFolder = olNS.Folders("Personal Folders") 'problem with this
statement

Running Outlook on my development PC, this works fine.
Running Outlook on the server where this is to operate:-
- When called as a script from an Outlook rule, the last line hangs.
- When I run this from the Immediate window, I get
   -2147221233 (8004010f)
   The operation failed. An object could not be found.

Any ideas how I can get this working?
Many thanks,
Rob
Sue Mosher [MVP-Outlook] - 02 Mar 2008 20:21 GMT
The error suggests that the mail profile being used by Outlook on that machine has no top-level store with a display name of Personal Folders. You can test this by iterating the top-level stores in the Immediate window:

   For Each TopFolder in Application.Session.Folders
       Debug.Print TopFolder.Name
   Next

Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook 2007 Programming:
    Jumpstart for Power Users and Administrators
   http://www.outlookcode.com/article.aspx?id=54

>I have a VBA macro that includes the lines
>
[quoted text clipped - 16 lines]
> Many thanks,
> Rob
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.