set out=createobject("outlook.application")
set namespace=out.getnamespace("mapi")
set mail=out.createitem(0)
mail.to=xmail
mail.HTMLBody=MyHTML
mail.subject=mailobject
set attached = mail.attachments
s = Split(ls, "{") '---splitto la lista di allegati CERCANDO IL SIMBOLO {
'-----------------------merge dei pdf indicati nei path righe del documento -------------------------------
Set fso = CreateObject("Scripting.FileSystemObject")
sFolder = pathdoc
bFirstDoc = True
' For Each strAttach In s
If LCase(Right(strAttach, 4)) = ".pdf" Then
If bFirstDoc Then
bFirstDoc = False
Set oMainDoc = CreateObject("AcroExch.PDDoc")
oMainDoc.Open strAttach
Else
Set oTempDoc = CreateObject("AcroExch.PDDoc")
oTempDoc.Open strAttach
oMainDoc.InsertPages oMainDoc.GetNumPages - 1, oTempDoc, 0, oTempDoc.GetNumPages, False
oTempDoc.Close
End If
End If
Next
set filesys=CreateObject("Scripting.FileSystemObject")
If Not filesys.FolderExists(sFolder) Then
Set folder = filesys.CreateFolder(sFolder)
End If
oMainDoc.Save 1, sFolder & "\"&attachname&".pdf"
oMainDoc.Close
'MsgBox "Creazione PDF Terminata"
'-----------------------merge dei pdf indicati nei path righe del documento -------------------------------
attached.Add sFolder & "\"&attachname&".pdf"
mail.Display
ls=""
'mail.send
Set mail = Nothing
Set out = Nothing
set ls = Nothing