Bonjour,
J'ai créé une macro sur Office 2010 (Office 14) et celle-ci fonctionne sans problème, par contre elle ne fonctionne plus sur Office 2007 (Office 12). Le but de cette macro est d'enregistrer une plage définie en pdf, puis de l''envoyer par mail.
Le problème viens très certainement de
Microsoft Outlook 1x Object Library
.
Pouvez-vous m'aider ?
MERCI !
Ci-dessous ladite macro :
Sub SendWithAtt()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim CurFile As String
Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
CurFile = ThisWorkbook.Path & "\" & "Bondecde.pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=CurFile, _
Quality:=xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
With olMail
.To = Cells(7, 3).Value
.CC = ""
.Subject = "Commande contenants " & Cells(1, 2).Value
.Body = "Bonjour, blablabla"
.Attachments.Add CurFile
'.Attachments.Add "c:\My Documents\book.doc"
.Display '.Send
End With
Set olMail = Nothing
Set olApp = Nothing
End Sub