Modification Macro envoi mail via outlook vers thunderbird
Bonjour,
je suis novice en Macro mais j'ai quand même pu créer quelques Macros en m'aidant sur votre Forum et je vous en remercie.
Mais je suis face à un soucis car mes Macros fonctionnent sur certain pc et pas sur d'autres à l'envoi du mail et je me demande si ce n'est pas Outlook qui me fait planter les Macro sur certain Pc.
Quelqu'un pourrait-il me transformer cette Macro pour envoyer les mails via Thunderbird?
Voici une de mes Macro qui Fonctionne sur mon pc via Outlook mais qui plante sur les autres pc de mes collègues.
En bleu est la partie qui plante chez mes collégues.
Merci pour votre aide.
Et bonne journée à tous.
olivier
Sub MAILJOSJM()
'
' MAILJOSJM MACRO
'
If MsgBox("Voulez-vous envoyer cette commande d'articles boulangerie ?", vbQuestion + vbYesNo, "MERCI :-)))") = vbYes Then
With Sheets("JOS JEAN MARIE")
.Range("C4:H4").Copy
.Range("C4:H4").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End With
With Sheets("VIERGE")
.Range("A1:F3").Copy
.Range("A1:F3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, _
IgnorePrintAreas:=False
'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 = Sheets("JOS JEAN MARIE").Cells(4, 3).Value & " " & Sheets("JOS JEAN MARIE").Cells(4, 5).Value & " " & Sheets("JOS JEAN MARIE").Cells(6, 4).Value
DateSortie = Sheets("JOS JEAN MARIE").Cells(6, 4).Value
Livraisonà = Sheets("JOS JEAN MARIE").Cells(6, 2).Value
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 = "*******@**********;" & "**********@***********.lu"
.CC = ""
.bcc = ""
.Subject = "COMMANDE BOULANGERIE MAISON " & " " & TempFileName
.Attachments.Add TempFilePath & TempFileName & ".pdf"
.Body = "Bonjour," & vbCrLf & vbCrLf & "voici une commande pour livraison le " & DateSortie & " à " & Livraisonà & vbCrLf & vbCrLf & "Merci de confirmer la commande" & vbCrLf & vbCrLf & "Bien à vous" & vbCrLf & vbCrLf & "Service Traiteur de la Maison "
'.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
Sheets("VIERGE").Select
Else
Exit Sub
End If
End Sub
Bonjour Olivier MICHEL,
Pour l'envoi de mail avec Thunderbird, réfère toi à ce topic :
https://forum.excel-pratique.com/excel/envoi-mail-avec-thunderbird-totalement-automatique-115259
bon courage
Bonsoir,
un grand merci pour votre réponse, j'ai trouvé le problème.
C'était un soucis de configuration de date dans le PC (région).
Donc maintenant mes Macro fonctionnent sur n'importe qu'elle pc.
Bonne soirée