Salve a tutti,
ho qualche problema nella creazione di una macro che automizzi il processo di
MailMerge.
Finora ho creato questo script, il quale non funziona proprio a dovere, in
quanto una volta eseguito la macro su un determinato template mi vengono creati
tanti file divisi con annessi comandi di campo per la stampa in serie
sostituiti dai nominativi della mia rubrica, ma che rimangono comunque comandi
di campo (<Matteo> per intenderci).
Ecco il segmento principale della mia macro:
Dim ooText
Dim ooCursor
Dim ooDesktop
Dim ooDocument
Dim ooFileList
Dim ooMailMerge
Dim ooCatSourceFile
Dim ooMailMergeOutputFile
Dim ooFileProperties(0) as new com.sun.star.beans.PropertyValue
Dim ooMailMergeProperties(8) as new com.sun.star.beans.NamedValue
ooMailMerge=createUNOService("com.sun.star.text.MailMerge")
ooMailMergeProperties(0).name="DataSourceName"
ooMailMergeProperties(0).value="MailMergeDatabase"
ooMailMergeProperties(1).name="CommandType"
ooMailMergeProperties(1).value=com.sun.star.sdb.CommandType.TABLE
ooMailMergeProperties(2).name="Command"
ooMailMergeProperties(2).value=ooCSVTable
ooMailMergeProperties(3).name="DocumentURL"
ooMailMergeProperties(3).value=convertToURL(ooTemplate + ooCSVTable +
".odt")
ooMailMergeProperties(4).name="OutputType"
ooMailMergeProperties(4).value=com.sun.star.text.MailMergeType.FILE
ooMailMergeProperties(5).name="OutputURL"
ooMailMergeProperties(5).value=convertToURL(ooOutputURL)
ooMailMergeProperties(6).name="SinglePrintJobs"
ooMailMergeProperties(6).value=TRUE
ooMailMergeProperties(7).name="FileNameFromColumn"
ooMailMergeProperties(7).value=FALSE
ooMailMergeProperties(8).name="FileNamePrefix"
ooMailMergeProperties(8).value=ooFileNamePrefix + "_"
ooMailMerge.execute(ooMailMergeProperties())
Se qualcuno pu� darmi una mano... grazie a tutti!