[AccessD] Export Contacts to Outlook

Jack and Pat drawbridgej at sympatico.ca
Sun Nov 7 14:46:27 CST 2010


Here's another approach based on some trial and error.
I created a DocketWorks Folder. I can open it with this vba code.
jack

Sub Rocky()
Dim olMapi As NameSpace
Dim i As Integer
Dim objFolder As MAPIFolder
Dim myFolders As Folders

Set myFolders = Application.GetNamespace("MAPI").Folders.GetFirst.Folders
    Set objFolder = myFolders.GetFirst
    Do Until objFolder Is Nothing
        i = i + 1
        If objFolder.Name = "DocketWorks" Then
        objFolder.Display
        
        Debug.Print " I have opened  a window >> " & objFolder.Parent &   _ 
    "     Folder(" & i & ")  " & objFolder.Name
        Else
        End If
        Set objFolder = myFolders.GetNext
    Loop

End Sub

-----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 12:47 PM
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




More information about the AccessD mailing list