Bonjour,
Je ne comprends pas pourquoi mon CurFile ne trouve pas la pj alors qu'elle est bien nommée.
Merci d'avance
Private Sub CommandButton4_Click()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim CurFile As String
Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
Dim sTmp As String, SigString As String
Dim Signature As String
Dim Strbody As String
Dim MonNom As String
Dim nom As String
MonNom = Workbooks("Demo.xlsm").Worksheets("Devis").Range("C11").Value
nom = Workbooks("Demo.xlsm").Sheets("CPR").Range("Z1").Value
ActiveSheet.Unprotect
' "C:\Users\Thierry\AppData\Local\Temp\MaFeuille.pdf "
CurFile = MonNom & "_" & nom & "_" & "Facture Demo" & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\rcheucle\Desktop\CLIENTS\ " & MonNom & "_" & nom & "_" & "Facture Demo" & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
Application.DisplayAlerts = True
Application.DisplayAlerts = False
SigString = Environ("appdata") & "\Microsoft\Signatures\*.htm"
If Dir(SigString) <> "" Then
sTmp = Environ("appdata") & "\Microsoft\Signatures\" & Dir(SigString)
Signature = GetBoiler(sTmp)
Else
Signature = ""
End If
formule_politesse = "<p>Bonjour Madame, Monsieur" & "," & "</p><p>" & "Veuillez trouvez-ci joint le devis en version PDF." & "</p><p>" & "Bonne journee," & "</p><p>" & "Cordialement." & "</p>" & "Demo" & "</p>" & "Demo" & "</p>" & "Demo" & "</p>" & "Mobile: 06.14.38.66.85" & "</p>" & "demo@gmail.com"
With olMail
.To = Range("C18").Value
.Subject = "Devis Demo du" & "_" & nom
.Attachments.Add CurFile
.HTMLBody = Strbody & formule_politesse
.Send
End With
Je ne comprends pas pourquoi mon CurFile ne trouve pas la pj alors qu'elle est bien nommée.
Merci d'avance
Private Sub CommandButton4_Click()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim CurFile As String
Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
Dim sTmp As String, SigString As String
Dim Signature As String
Dim Strbody As String
Dim MonNom As String
Dim nom As String
MonNom = Workbooks("Demo.xlsm").Worksheets("Devis").Range("C11").Value
nom = Workbooks("Demo.xlsm").Sheets("CPR").Range("Z1").Value
ActiveSheet.Unprotect
' "C:\Users\Thierry\AppData\Local\Temp\MaFeuille.pdf "
CurFile = MonNom & "_" & nom & "_" & "Facture Demo" & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\rcheucle\Desktop\CLIENTS\ " & MonNom & "_" & nom & "_" & "Facture Demo" & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
Application.DisplayAlerts = True
Application.DisplayAlerts = False
SigString = Environ("appdata") & "\Microsoft\Signatures\*.htm"
If Dir(SigString) <> "" Then
sTmp = Environ("appdata") & "\Microsoft\Signatures\" & Dir(SigString)
Signature = GetBoiler(sTmp)
Else
Signature = ""
End If
formule_politesse = "<p>Bonjour Madame, Monsieur" & "," & "</p><p>" & "Veuillez trouvez-ci joint le devis en version PDF." & "</p><p>" & "Bonne journee," & "</p><p>" & "Cordialement." & "</p>" & "Demo" & "</p>" & "Demo" & "</p>" & "Demo" & "</p>" & "Mobile: 06.14.38.66.85" & "</p>" & "demo@gmail.com"
With olMail
.To = Range("C18").Value
.Subject = "Devis Demo du" & "_" & nom
.Attachments.Add CurFile
.HTMLBody = Strbody & formule_politesse
.Send
End With