A
albissim
Hallo,
I need some help for a macro code ... we've a lot of Word2000 mail-merge
templates originally connected to a .dbf file where in a textbox is possible
put the number we're looking for , now we've to move to Word2003 and the new
source will be a SQL file with the same structure
At the moment we use a code like this:
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdFirstRecord
Set myMMData = ActiveDocument.MailMerge.DataSource
If myMMData.FindRecord(FindText:=TextBox1, _
Field:="COLLAB") = True Then
myMMData.QueryString = _
"SELECT * FROM `COLLABORATORI` WHERE ((`COLLAB` = '" & TextBox1.Text & "'))"
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
Unload Me
Application.ScreenUpdating = True
Else
MsgBox ("Codice non trovato !!!")
--
I tried to record the piece of code to be replaced in the existing macro but
I wasn't able to ...
Thanks in advance for your help
Regards,
Alberto Simone
I need some help for a macro code ... we've a lot of Word2000 mail-merge
templates originally connected to a .dbf file where in a textbox is possible
put the number we're looking for , now we've to move to Word2003 and the new
source will be a SQL file with the same structure
At the moment we use a code like this:
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdFirstRecord
Set myMMData = ActiveDocument.MailMerge.DataSource
If myMMData.FindRecord(FindText:=TextBox1, _
Field:="COLLAB") = True Then
myMMData.QueryString = _
"SELECT * FROM `COLLABORATORI` WHERE ((`COLLAB` = '" & TextBox1.Text & "'))"
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
Unload Me
Application.ScreenUpdating = True
Else
MsgBox ("Codice non trovato !!!")
--
I tried to record the piece of code to be replaced in the existing macro but
I wasn't able to ...
Thanks in advance for your help
Regards,
Alberto Simone