Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    New Jersey
    Posts
    103
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Need to automatically send PDFs to email individually - 450 PDFs

    Hi, I have this awesome code that Paul Edestein wrote, HE IS AWESOME. But now I need it to automatically send the PDFs to outlook email. Does anyone know how I can do this? I have around 450 PDF docs in a folder that I need to send out via email. The file has a field called Email that contains the address.

    Thanks so much for your help.



    Sub Merge_To_Individual_Files()
    'Merges one record at a time to the folder containing the mailmerge main document.
    ' Sourced from: http://windowssecrets.com/forums/sho...ips-amp-Tricks
    Application.ScreenUpdating = False
    Dim StrFolder As String, StrName As String, MainDoc As Document, i As Long, j As Long
    Set MainDoc = ActiveDocument
    With MainDoc
    StrFolder = .Path & Application.PathSeparator
    For i = 1 To .MailMerge.DataSource.RecordCount
    With .MailMerge
    .Destination = wdSendToNewDocument
    .SuppressBlankLines = True
    With .DataSource
    .FirstRecord = i
    .LastRecord = i
    .ActiveRecord = i
    If Trim(.DataFields("LastName")) = "" Then Exit For
    StrName = .DataFields("LastName") & "_" & .DataFields("First_Name")
    End With
    .Execute Pause:=False
    End With
    For j = 1 To 255
    Select Case j
    Case 1 To 31, 33, 34, 37, 42, 44, 46, 47, 58 - 63, 91 - 93, 96, 124, 147, 148
    StrName = Replace(StrName, Chr(j), "")
    End Select
    Next
    StrName = Trim(StrName)
    With ActiveDocument
    ' .SaveAs FileName:=StrPath & StrName & ".docx", FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=False
    ' and/or:
    .SaveAs FileName:=StrPath & StrName & ".pdf", FileFormat:=wdFormatPDF, AddToRecentFiles:=False
    .Close SaveChanges:=False
    End With
    Next i
    End With
    Application.ScreenUpdating = True
    End Sub

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Please see my reply in your other thread. Please also don't ask essentially the same question in multiple threads. Thread closed.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •