|
-
Oct 13th, 2005, 11:57 AM
#1
Thread Starter
Junior Member
VBA Access to connect to Outlook
Hello,
Can anyone send me code to connect to oulook and get information from oulook from Visual basic or VBA.
Thanks,
Prasad
-
Oct 13th, 2005, 11:58 AM
#2
Re: VBA Access to connect to Outlook
What information are you looking for?
Also, the methods of gathering this is sightly different between VB and VBA. Which platform will you be using?
-
Oct 13th, 2005, 12:07 PM
#3
Thread Starter
Junior Member
Re: VBA Access to connect to Outlook
I will be using VBA and want to get first name,last name,middle and alias name.
-
Oct 13th, 2005, 12:08 PM
#4
Re: VBA Access to connect to Outlook
 Originally Posted by kprasadreddy
I will be using VBA and want to get first name,last name,middle and alias name.
From the properties page of the Global Address Book?
-
Oct 13th, 2005, 12:13 PM
#5
Thread Starter
Junior Member
Re: VBA Access to connect to Outlook
from the work outlook in the company
-
Oct 13th, 2005, 02:43 PM
#6
Thread Starter
Junior Member
Re: VBA Access to connect to Outlook
I want to be able to get all the firstnames, lastnames and aliases in the outlook exchange server in our company.
Also I am trying to add a contact to my oulook from code...
Private Sub CmdAddContact_Click()
Dim objOutlook As New Outlook.Application
Dim objContact As ContactItem
Set objContact = objOutlook.CreateItem(olContactItem)
With objContact
.First = "xyz"
.Last = "test"
.Alias = "E123456"
.Save 'Save the new contact
End With
Set objContact = Nothing
Set objOutlook = Nothing
End Sub
and get a message at .First =""xyz"
Runtime error '438'
Object doesnt support this propery or method
Any help is greatly appreciated.
Thanks,
Prasad
Last edited by kprasadreddy; Oct 13th, 2005 at 03:24 PM.
-
Oct 14th, 2005, 06:25 AM
#7
Re: VBA Access to connect to Outlook
VBA question moved to Office Development.
-
Oct 15th, 2005, 08:33 PM
#8
Re: VBA Access to connect to Outlook
I used to go into the GroupWise AddressBook, and select EXPORT ALL, and download it to a PC, and then zip it to a floppy disk. Wasn't pretty, but it worked.
-
Oct 16th, 2005, 11:53 AM
#9
Re: VBA Access to connect to Outlook
Well the poster does not want to do it manually as stated in his post he wants to do it programmatically.
If you want to get the local Contacts and not Global ones then your code only needs a little tweeking.
VB Code:
Private Sub Command1_Click()
Dim objOutlook As New Outlook.Application
Dim objContact As Outlook.ContactItem
Set objContact = objOutlook.CreateItem(olContactItem)
With objContact
.FirstName = "xyz"
.LastName = "test"
'.Alias = "E123456" 'Not supported using the OOM
.Save 'Save the new contact
End With
Set objContact = Nothing
objOutlook.Quit
Set objOutlook = Nothing
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|