mercredi 18 mars 2015
marco mail
Posted on 08:36 by Unknown
mijn vraag is de volgende:
ik heb onderstaande macro in een sheet staan maar op het moment ik de macro uitvoer gaat ie 2 mails aanmaken,
de bestaande sheet en een andere sheet uit het bestand.
ik wil alleen maar de sheet waarin in sta in de mail hebben.
ik kom er niet uit wat er verkeerd staat. wie kan mij helpen??
'Create a PDF and mail of every sheet with a mail address in cell G16 (Sheet7)
'You see that the code create two mails, one with sheet7 and one with sheet7 and send it
'to the address in G16 of that sheet.
Sub MailRekeningTAV()
'Working only in 2007 and up
Dim sh As Worksheet
Dim TempFilePath As String
Dim TempFileName As String
Dim FileName As String
'Temporary path to save the PDF files
'You can also use another folder like
'TempFilePath = "D:\facturen PDF\"
TempFilePath = Environ$("temp") & "\"
'Loop through every worksheet
For Each sh In ThisWorkbook.Worksheets
FileName = ""
'Test G16 for a mail address
If sh.Range("G16").Value Like "?*@?*.?*" Then
'If there is a mail address in G16 create the file name and the PDF
TempFileName = TempFilePath & "Factuur" & " " _
& _
Range("H11") & Range("V1") & Range("V3") & ".pdf"
FileName = RDB_Create_PDF(sh, TempFileName, True, False)
'If publishing is OK create the mail
If FileName <> "" Then
RDB_Mail_PDF_Outlook FileName, sh.Range("G16").Value, "factuur", _
"bijgaand vind U de factuur" _
& vbNewLine & vbNewLine & "Groeten namens taxi-Peerenboom" _
& vbNewLine & "T 024-3971236" _
& vbNewLine & "Email: info@taxipeerenboom.nl" _
& vbNewLine & "Website: http://ift.tt/1MJL8wY;, False
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End If
Next sh
End Sub
ik heb onderstaande macro in een sheet staan maar op het moment ik de macro uitvoer gaat ie 2 mails aanmaken,
de bestaande sheet en een andere sheet uit het bestand.
ik wil alleen maar de sheet waarin in sta in de mail hebben.
ik kom er niet uit wat er verkeerd staat. wie kan mij helpen??
'Create a PDF and mail of every sheet with a mail address in cell G16 (Sheet7)
'You see that the code create two mails, one with sheet7 and one with sheet7 and send it
'to the address in G16 of that sheet.
Sub MailRekeningTAV()
'Working only in 2007 and up
Dim sh As Worksheet
Dim TempFilePath As String
Dim TempFileName As String
Dim FileName As String
'Temporary path to save the PDF files
'You can also use another folder like
'TempFilePath = "D:\facturen PDF\"
TempFilePath = Environ$("temp") & "\"
'Loop through every worksheet
For Each sh In ThisWorkbook.Worksheets
FileName = ""
'Test G16 for a mail address
If sh.Range("G16").Value Like "?*@?*.?*" Then
'If there is a mail address in G16 create the file name and the PDF
TempFileName = TempFilePath & "Factuur" & " " _
& _
Range("H11") & Range("V1") & Range("V3") & ".pdf"
FileName = RDB_Create_PDF(sh, TempFileName, True, False)
'If publishing is OK create the mail
If FileName <> "" Then
RDB_Mail_PDF_Outlook FileName, sh.Range("G16").Value, "factuur", _
"bijgaand vind U de factuur" _
& vbNewLine & vbNewLine & "Groeten namens taxi-Peerenboom" _
& vbNewLine & "T 024-3971236" _
& vbNewLine & "Email: info@taxipeerenboom.nl" _
& vbNewLine & "Website: http://ift.tt/1MJL8wY;, False
Else
MsgBox "Not possible to create the PDF, possible reasons:" & vbNewLine & _
"Microsoft Add-in is not installed" & vbNewLine & _
"The path to Save the file in arg 2 is not correct" & vbNewLine & _
"You didn't want to overwrite the existing PDF if it exist"
End If
End If
Next sh
End Sub
marco mail
Categories: marco mail
Inscription à :
Publier les commentaires (Atom)
0 commentaires:
Enregistrer un commentaire