WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE and Outlook
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get Contact data form Contact Item Currently Selected in Outlook


; Setup connection to Outlook 
myOlApp = ObjectCreate("Outlook.Application")
myOlExp = myOlApp.ActiveExplorer
myFolder = myOlExp.CurrentFolder

myCurrItem = myFolder.CurrentView.name ; use this to find out how the contacts are being displayed i.e. as Address Cards 
if myCurrItem != "Address Cards"
    Message("Error","Contact not being displayed in Outlook") 
    myFolder = 0
    myExplorer = 0
    myOlApp = 0
    exit
endif
data = ""
myOlSel = myOlExp.Selection
For x = 1 To myOlSel.Count
    title = myOlSel.Item(x).FullName 
    data = StrCat(data, "BusinessTelephoneNumber ", myOlSel.Item(x).BusinessTelephoneNumber, @Crlf) 
    data = StrCat(data, "HomeTelephoneNumber ", myOlSel.Item(x).HomeTelephoneNumber, @Crlf) 
    data = StrCat(data, "MobileTelephoneNumber ", myOlSel.Item(x).MobileTelephoneNumber)
    Message(title,data)
Next 

Article ID:   W17126
File Created: 2007:07:03:14:28:24
Last Updated: 2007:07:03:14:28:24