A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Problems accessing named folder from VBA



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 29th 08, 03:50 PM posted to microsoft.public.outlook.program_vba
Rob
external usenet poster
 
Posts: 146
Default Problems accessing named folder from VBA

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


Ads
  #2  
Old March 2nd 08, 08:21 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Problems accessing named folder from VBA

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

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


"rob" wrote in message ...
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


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recover Local Named Folder? ColTom2 Outlook Express 10 February 9th 08 02:59 AM
problems accessing the .ost file Curtis Outlook - Installation 1 December 8th 07 04:54 PM
Named properties in PS_INTERNET_HEADERS don't go back to named properties when recieved. Vandal Add-ins for Outlook 4 October 3rd 07 02:54 PM
problems with comcast accessing outlook Fishstick48 Outlook - General Queries 1 May 19th 07 01:43 AM
Accessing named property using outlook object model AtulSureka Outlook - Using Forms 4 December 1st 06 05:06 PM


All times are GMT +1. The time now is 03:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.