Je n'arrive pas a intégrer la petite macro cela bug.
Ci joint ma macro serait il possible de l intégrer au bon endroit ?
Merci beaucoup.
Sub mail()
'
' trieusecolisnonsortit Macro
'
'
ActiveSheet.Range("$A$2:$W$32421").AutoFilter Field:=11, Criteria1:="NON"
'Fonctionne sous excel 2000-2013
Dim FileExtStr As String
Dim FileFormatNum As Long
Dim Sourcewb As Workbook
Dim destwb As Workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim OutApp As Object
Dim OutMail As Object
Dim S As Shape
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set Sourcewb = ActiveWorkbook
'Copie la feuille active comme nouvelle feuille
ActiveSheet.Copy
Set destwb = ActiveWorkbook
'Désactiver fenêtre de compatibilité
Application.DisplayAlerts = False
'----------------------------------------------------------------------------
'Sauvegarde la nouvelle feuille/L'envoie par mail/La supprime
'----------------------------------------------------------------------------
TempFilePath = Environ$("temp") & "\"
TempFileName = ActiveSheet.Name
Set OutApp = CreateObject("outlook.application")
Set OutMail = OutApp.CreateItem(0)
With destwb
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=TempFilePath & TempFileName & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False ' sauvegarde du fichier au format pdf
On Error Resume Next
With OutMail
.To = "customs@linex.fr"
.CC = "ops@linexcdg.fr"
.Subject = "MAJ fret cathay à ne pas sortir"
.Attachments.Add TempFilePath & TempFileName & ".pdf"
.Body = "Bonjour, Merci de trouver ci joint la mise à jour des colis à ne pas sortir. Cordialement "
'.display 'ou alors utiliser
.Send 'pour envoi
End With
On Error GoTo 0
.Close savechanges:=False
End With
'Effacer le fichier envoyé
Kill TempFilePath & TempFileName & ".pdf"
Set OutMail = Nothing
Set OutApp = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
' ANNULATIONTRIEUSE Macro
'
'
ActiveSheet.Range("$A$2:$W$32421").AutoFilter Field:=11
ActiveWindow.SmallScroll Down:=-18
End Sub