You're usually better off posting programming questions in a programming
group.
Did you register Redemption? Is it in your VBA project references?
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
r kimball wrote in message ...
I had a macro that worked fine in Outlook 2003 under windows 2K; on a new
machine running windows xp sp2 and outlook 2007, it doesn't work. This
macro copied info from a selected contact to the clipboard with just one
click: very useful! Error message is : "Compile error: Can't find project
or library." Offending line is: Set mySafeContact =
CreateObject("Redemption.SafeContactItem") Can anyone help? I have
installed Redemption. Here is the relevant code. Thanks in advance!!
Sub copy_contact_info()
Dim ol As New Outlook.Application
Dim sl As Outlook.Selection
Dim myExplorer As Outlook.Explorer
Dim strContactInfo As String
Dim MyData As New MSForms.dataObject
Dim mySafeItem As Object
Set myExplorer = ol.ActiveExplorer
Set sl = myExplorer.Selection
Set mySafeContact = CreateObject("Redemption.SafeContactItem")
Set mySafeContact.Item = sl.Item(1)
With mySafeContact
strContactInfo = FormatEntryBreak(.FullName)
If .BusinessAddressStreet "" Then
strContactInfo = strContactInfo & FormatEntryBreak("Business:")
strContactInfo = strContactInfo & FormatEntryBreak(.JobTitle)
strContactInfo = strContactInfo & FormatEntryBreak(.CompanyName)
strContactInfo = strContactInfo &
FormatEntryBreak(.BusinessAddressStreet)
strContactInfo = strContactInfo &
FormatEntryComma(.BusinessAddressCity)
strContactInfo = strContactInfo & " " & .BusinessAddressState
strContactInfo = strContactInfo & " " & .BusinessAddressPostalCode
& vbCrLf
If .BusinessAddressCountry "United States of America" Then
strContactInfo = strContactInfo &
FormatEntryBreak(.BusinessAddressCountry) & vbCrLf & vbCrLf
End If
strContactInfo = strContactInfo & vbCrLf
End If
If .HomeAddressStreet "" Then
strContactInfo = strContactInfo & FormatEntryBreak("Home:")
strContactInfo = strContactInfo &
FormatEntryBreak(.HomeAddressStreet)
strContactInfo = strContactInfo &
FormatEntryComma(.HomeAddressCity)
strContactInfo = strContactInfo & " " & .HomeAddressState
strContactInfo = strContactInfo & " " & .HomeAddressPostalCode &
vbCrLf
If .HomeAddressCountry "United States of America" Then
strContactInfo = strContactInfo &
FormatEntryBreak(.HomeAddressCountry) & vbCrLf
End If
strContactInfo = strContactInfo & vbCrLf
End If
If .OtherAddressStreet "" Then
strContactInfo = strContactInfo & FormatEntryBreak("Other:")
strContactInfo = strContactInfo &
FormatEntryBreak(.OtherAddressStreet)
strContactInfo = strContactInfo &
FormatEntryComma(.OtherAddressCity)
strContactInfo = strContactInfo & " " & .OtherAddressState
strContactInfo = strContactInfo & " " & .OtherAddressPostalCode &
vbCrLf
If .OtherAddressCountry "United States of America" Then
strContactInfo = strContactInfo &
FormatEntryBreak(.OtherAddressCountry) & vbCrLf
End If
strContactInfo = strContactInfo & vbCrLf
End If
If .HomeTelephoneNumber "" Then
strContactInfo = strContactInfo & FormatEntryBreak("H: " &
.HomeTelephoneNumber)
End If
If .BusinessTelephoneNumber "" Then
strContactInfo = strContactInfo & FormatEntryBreak("O: " &
.BusinessTelephoneNumber)
End If
If .BusinessFaxNumber "" Then
strContactInfo = strContactInfo & FormatEntryBreak("F: " &
.BusinessFaxNumber)
End If
If .MobileTelephoneNumber "" Then
strContactInfo = strContactInfo & FormatEntryBreak("M: " &
.MobileTelephoneNumber)
End If
If .Email1Address "" Then
strContactInfo = strContactInfo & vbCrLf &
FormatEntryBreak(.Email1Address)
End If
If .Email2Address "" Then
strContactInfo = strContactInfo & vbCrLf &
FormatEntryBreak(.Email2Address)
End If
End With
MyData.SetText strContactInfo
MyData.PutInClipboard
End Sub
EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com