Hello,
Can anyone send me code to connect to oulook and get information from oulook from Visual basic or VBA.
Thanks,
Prasad
Printable View
Hello,
Can anyone send me code to connect to oulook and get information from oulook from Visual basic or VBA.
Thanks,
Prasad
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?
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?Quote:
Originally Posted by kprasadreddy
from the work outlook in the company
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
VBA question moved to Office Development.
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.
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