Hope you can help me with a problem...
Ok a problem with defining a select query for a mail merge.
I want to have a pop-up box and then use this value an the query data for a mail merge and have written the following quick macro:
' test_mail_merge Macro
' Macro by JPC
Dim payno As Integer
payno = InputBox("payroll number", "Payroll Selection", 0)
ActiveDocument.MailMerge.DataSource.QueryString = _
"SELECT * FROM C:\Documents and Settings\client\Desktop\test merge data.csv WHERE ((Payroll = payno))"
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
If i replace the "payno" variable in the SELECT query with a real variable the merge works fine and only merges one record, i'm obviopusly using the defined variable "payno" incorectly, have tried removing brackets ect but no luck, any ideas.