From Word?
Sub AddOutlookCont()
Dim ol As New Outlook.Application
Dim ci As ContactItem
Dim strAddress As String
Dim strFullName As String
strAddress = Selection.Range
iResult = MsgBox("Is the email address correct?" & _
vbCr & vbCr & strAddress, vbYesNo, "Address")
If iResult = 7 Then GoTo UserCancelled:
name:
strFullName = InputBox("Enter contact's name" _
& vbCr & "in the format 'Mr. John Smith", "Contact name")
On Error GoTo UserCancelled:
Set ci = ol.CreateItem(olContactItem)
If strFullName <> "" Then
ci.FullName = strFullName
Else
MsgBox "Name cannot be left blank"
GoTo name:
End If
ci.FileAs = strFullName
ci.Email1Address = strAddress
ci.Save
' ol.Quit
Set ol = Nothing
Exit Sub
UserCancelled:
MsgBox "User Cancelled or address not selected"
Set ol = Nothing
End Sub
http://www.gmayor.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
Word MVP web site
http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
moosecoyotebear wrote:
> can anybody please tell me how thank you