Ciao Maurizio,
grazie per la risposta :-)
Scusa se rispondo solo ora, nel tempo libero sto cercando di imparare access ed è una montagna piuttosto impervia per me :-)
Andando in topic,
Il codice è questo:
Public Sub Test2()
On Error GoTo ErrH
Dim objWdMailMerge As Word.MailMerge
Dim lngRecNum As Long
Dim strPath As String
Dim strFilename As String
Application.ScreenUpdating = False
strPath = "C:\Users\carlo\Documents\stampaunione"
Set objWdMailMerge = ThisDocument.MailMerge
With objWdMailMerge
.Destination = wdSendToNewDocument
With .DataSource
.ActiveRecord = wdLastRecord
lngRecNum = .ActiveRecord
.ActiveRecord = wdFirstRecord
Do
.FirstRecord = .ActiveRecord
.LastRecord = .ActiveRecord
strFilename = "prova in data " & .DataFields("data").Value & " test"
If Len(strFilename) Then
strFilename = strPath & strFilename
objWdMailMerge.Execute
With ActiveDocument
.SaveAs strFilename, wdFormatPDF, AddToRecentFiles:=False
.Saved = True
.Close
End With
End If
If .ActiveRecord = lngRecNum Then Exit Do
.ActiveRecord = wdNextRecord
Loop
End With
End With
ExitProc:
Application.ScreenUpdating = True
Set objWdMailMerge = Nothing
Exit Sub
ErrH:
MsgBox Err.Description
Resume ExitProc
End Sub
Come test, ho creato una tabella in un file excel molto semplice:
data / codice cliente
01/02/2013
/ pippo_it
02/05/2013 / pluto_it
In caso possa essere utile, ho caricato una cartella zippata qui:
macro-unione.zip.html
Grazie per il supporto :-)
Carlo