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

How to access over VBA in Outlook 2003 contacts in other Datafiles?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 20th 07, 11:40 AM posted to microsoft.public.outlook.program_vba
Oliver Burkhardt
external usenet poster
 
Posts: 4
Default How to access over VBA in Outlook 2003 contacts in other Datafiles?

Hi!

I know how to access via VBA the contacts in the 'Personal Folder'.

But if I open a new Datafile, I don't know to access the contacts there?

Who could help me?
Thx a lot.

Greets, Oli


  #2  
Old February 20th 07, 12:38 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to access over VBA in Outlook 2003 contacts in other Datafiles?



Oli, you can simply walk through the folder hierarchy.
Application.Session.Folders gives you all opened, visible top folders.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Tue, 20 Feb 2007 12:40:22 +0100 schrieb Oliver Burkhardt:

Hi!

I know how to access via VBA the contacts in the 'Personal Folder'.

But if I open a new Datafile, I don't know to access the contacts there?

Who could help me?
Thx a lot.

Greets, Oli

  #3  
Old February 21st 07, 12:12 AM posted to microsoft.public.outlook.program_vba
Oliver Burkhardt
external usenet poster
 
Posts: 4
Default How to access over VBA in Outlook 2003 contacts in other Datafiles?

Thank you very much Michael!

So I wrote this code:
It works, but how do I select the contact folder in the dasistes Folder?

Thanks a lot.

Public Sub test()
Dim toplevelfolder As Object
Dim dasistes As Object
Dim myNamespace As Outlook.NameSpace

For Each toplevelfolder In Application.Session.Folders
'MsgBox toplevelfolder.Name
If InStr(1, toplevelfolder.Name, "form", vbTextCompare) Then

Set dasistes = toplevelfolder
MsgBox "JETZT"
End If


Next toplevelfolder

MsgBox dasistes.Name

'MsgBox dasistes.Name
End Sub



"Michael Bauer [MVP - Outlook]" schrieb im Newsbeitrag
...


Oli, you can simply walk through the folder hierarchy.
Application.Session.Folders gives you all opened, visible top folders.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Tue, 20 Feb 2007 12:40:22 +0100 schrieb Oliver Burkhardt:

Hi!

I know how to access via VBA the contacts in the 'Personal Folder'.

But if I open a new Datafile, I don't know to access the contacts there?

Who could help me?
Thx a lot.

Greets, Oli



  #4  
Old February 21st 07, 06:07 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to access over VBA in Outlook 2003 contacts in other Datafiles?



You need to know the folder's name and its path. For instance:

Path="Persönliche Ordner\Kontakte"
set dasistes=toplevelfolder("Kontakte")

Path="Persönliche Ordner\Kontakte\Familie"
set dasistes=toplevelfolder("Kontakte").Folders("Famil ie")

Depending on the case, maybe the user can/should select the folder. That's
possible with the Pickfolder function.

Once, you have the folder, and if it's always the same, you could store its
EntryID and StoreID and from then on get the reference via GetFolderFromID
function.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Wed, 21 Feb 2007 01:12:42 +0100 schrieb Oliver Burkhardt:

Thank you very much Michael!

So I wrote this code:
It works, but how do I select the contact folder in the dasistes Folder?

Thanks a lot.

Public Sub test()
Dim toplevelfolder As Object
Dim dasistes As Object
Dim myNamespace As Outlook.NameSpace

For Each toplevelfolder In Application.Session.Folders
'MsgBox toplevelfolder.Name
If InStr(1, toplevelfolder.Name, "form", vbTextCompare) Then

Set dasistes = toplevelfolder
MsgBox "JETZT"
End If


Next toplevelfolder

MsgBox dasistes.Name

'MsgBox dasistes.Name
End Sub



"Michael Bauer [MVP - Outlook]" schrieb im Newsbeitrag
...


Oli, you can simply walk through the folder hierarchy.
Application.Session.Folders gives you all opened, visible top folders.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Tue, 20 Feb 2007 12:40:22 +0100 schrieb Oliver Burkhardt:

Hi!

I know how to access via VBA the contacts in the 'Personal Folder'.

But if I open a new Datafile, I don't know to access the contacts there?

Who could help me?
Thx a lot.

Greets, Oli

 




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
How to access over VBA in Outlook 2003 contacts in other Datafiles? Oliver Burkhardt Outlook - Using Contacts 1 March 23rd 07 01:08 PM
Importing Contacts: From Access XP to Outlook 2003 sctvoice Outlook - Using Contacts 1 January 25th 07 03:50 AM
Access automating Outlook using VBA no longer working [email protected] Outlook and VBA 5 May 9th 06 01:04 AM
Using VBA for Outlook and VBA for Access within Access Sardonic Outlook and VBA 1 March 17th 06 12:34 PM
Delete Custom Outlook Control thru Access VBA Sue Mosher [MVP-Outlook] Outlook - Using Forms 0 January 20th 06 05:29 PM


All times are GMT +1. The time now is 05:59 AM.


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.