[AccessD] Export Contacts to Outlook

Rocky Smolin rockysmolin at bchacc.com
Mon Nov 8 10:49:00 CST 2010


So at Susan's suggestion I wrote to Helen Feddema and got a response right
away.  The answer was, of course, simple, once you know it:

Set olFolder = GetFolder("\\Personal Folders\Contacts\DocketWorks")

Her full response:

"I am attaching a document with the syntax for referencing Outlook folders
in various locations.
 
However, there is another method you can use in this case, since (as I am
sure you are aware, even if the client isn't) that it is not a good idea to
hard-code paths.  You can put an Outlook path selector on the main menu,
using the PickFolder method to store the selected Outlook folder in a custom
database property, and then retrieve it for use in code.  That way, if the
path needs to be changed at some point, it can be done by just selecting
another folder on the main menu.  See Access Archon #185 (attached) for a
description of this method."

And I agree - that folder should be located using the Picker and stored
somewhere as a default but editable in case the folder gets moved or the app
is installed on another machine where that exported contact list might be in
a different place or under a different name.

The zip file she sent had an mdb with routines to select document paths as
well as an outlook folder and a sub to import contacts and send contact
letters.  The mdb if named Folder Path Selectors (AA 185).mdb and I'm not
sure if it's on her site, but if anyone would like the zip file and/or
document with the syntax for getting all kinds of folders form outlook, let
me know off-line - or here until the moderators get annoyed. 

Rocky


 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jack and Pat
Sent: Sunday, November 07, 2010 6:17 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Export Contacts to Outlook

More testing and I got an answer at VBAX

Sample code  ----watch line wrap

Sub crow()
Dim olnamespace As NameSpace
Dim olfolder As MAPIFolder
Set olfolder = Application.GetNamespace("MAPI").Folders("Personal Home
Folders").Folders("Keepers")
olfolder.Display
End Sub


jack
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Sunday, November 07, 2010 6:03 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Export Contacts to Outlook

Jack:

Stand by.  I just got an email from Helen Feddema.  She says she knows the
syntax I need and included another method to do the same thing. Haven't had
a chance to look at it though.  Will report back presently.

Rocky
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jack and Pat
Sent: Sunday, November 07, 2010 9:47 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Export Contacts to Outlook

Rocky,

I'm not an Outlook person really. I have done some vba for Outlook and have
never really understood the object model.
In the code I referenced in my earlier email, I found I had to give the
folder path starting with "// my top level/.../level I wanted to be at"
Using the GetFolder function, it opened a new window at the folder I wanted.
It worked for 2 different folders in 2 different pst files.

I still don't understand why there isn't a syntax along the line of

Application.Outlook.Folders.Folder("FolderYouWant)"

I've tried posting on OutlookCode.com  and vbaexpress.com but haven't gotten
much back.

The OutlookCode.com is run by Sue Mosher who has written many books/articles
on Outlook.

I hope you find a solution that we can share.
jack

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Sunday, November 07, 2010 10:30 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Export Contacts to Outlook

Well, I'm trying that code that Jack posted - a function that searches for
the folder passed to it. So it shouldn't matter if they move the folder -
the function should find it.  I think...

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: Sunday, November 07, 2010 7:04 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Export Contacts to Outlook

Using an index isn't the same as hard-coding though Rocky. I'm wondering --
with an index value of 0, would adding or deleting other folders ever impact
DocketWorks' position and thus index value? I'm thinking no... but really
not sure.

Susan H.


> Jack:
>
> The code looks like it should work but at the line:
>
> Set TestFolder = olNameSpace.Folders.Item(FoldersArray(0))
>
> I get that same error message "The operation failed.  An object could 
> not be found."  FoldersArray(0) contains "DocketWorks".
>
> I tried passing "\\Contacts\DocketWorks\  but got the same error 
> looking for Contacts.
>
> There's something screwy with my app here.  But I can't see it.
>
> Anything else you think I could try?
>

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list