|
|
Hi everybody, I have an excel file including a macro to send an e-mail for notification before it is saved. I used MS Outlook 11.0 Object Library reference and it worked successfully for Office 2003. One of my collegues has Ofiice 2007.When he opened the same file in his own PC and run the macro, it is changed to MS Outlook 12.0 Object Library reference automatically.
So if somebody re-opens the same file in MS Ofiice 2003 he takes the error for missing reference. So it seems Outlook 12.0 Object Library is not backward compatible.. How can I write the macro for running on both platforms(Ofiice 2003 and 2007) Thanks in advance.. Regards..
------------------------------------------------------------------------------------------- Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim olApp As Outlook.Application ' this line needs reference for working succesfully Dim objMail As Outlook.MailItem Dim Response Dim body Dim strTo As String
strTo ="aaa[ at ]bb.com.tr"
Response = MsgBox("Informing others for update, accept?", vbOKCancel, "Warning")
If Response = vbOK Then Set olApp = Outlook.Application 'Create e-mail item Set objMail = olApp.CreateItem(olMailItem) 'For an internal link body = "<a href=" & Chr(34) & "c\New Folder" & Chr(34) & "> The file name</A>" body = body & vbCrLf & " please follow the link for change..." With objMail .To = strTo .Subject = "File is updated." .HTMLBody = body .Send End With Set objMail = Nothing Set olApp = Nothing End If
End Sub
------------------------------------------------------------------------------------------ IT Specialist
|
|
|