V
Vimal
Hi,
Am trying to generate documents through mail merge and are having
problems problems with the mail merge fields embedded in IF
conditions.
Because the number of documents which the user can generate varies(the
maximum is about 60 to 70) and thereby affect the processing time for
the values of the merge fields, we read the merge fields from the
selected documents and process only those merge fields. I haven't
encountered any problems with the normal merge fields except for the
field embedded in 'IF conditions'. The following is the code am using
for this purpose:
Set objWordDocApp = New Word.Application
Set objWordDoc = objWordDocApp.Documents.Open(strFileName)
For Each objMMField In objWordDOC.MailMerge.fields
objMMField.Select
strTemp = strTemp & "~" & objMMField.Code.Text
Next
In case of IF conditions, the following sample text is returned:
IF MERGEFIELD StringLesseeDebtor = "Lessee" "lease" "finance"
Is there some way how I can just get the merge field alone e.g.
MERGEFIELD StringLesseeDebtor?
Also, can you please give me an insight into how to read these fields
when the levels of nesting gets more complex.
Been banging my head on this for quite some time and would appreciate
any help in this regard.
Thanks in advance.
Vimal
Am trying to generate documents through mail merge and are having
problems problems with the mail merge fields embedded in IF
conditions.
Because the number of documents which the user can generate varies(the
maximum is about 60 to 70) and thereby affect the processing time for
the values of the merge fields, we read the merge fields from the
selected documents and process only those merge fields. I haven't
encountered any problems with the normal merge fields except for the
field embedded in 'IF conditions'. The following is the code am using
for this purpose:
Set objWordDocApp = New Word.Application
Set objWordDoc = objWordDocApp.Documents.Open(strFileName)
For Each objMMField In objWordDOC.MailMerge.fields
objMMField.Select
strTemp = strTemp & "~" & objMMField.Code.Text
Next
In case of IF conditions, the following sample text is returned:
IF MERGEFIELD StringLesseeDebtor = "Lessee" "lease" "finance"
Is there some way how I can just get the merge field alone e.g.
MERGEFIELD StringLesseeDebtor?
Also, can you please give me an insight into how to read these fields
when the levels of nesting gets more complex.
Been banging my head on this for quite some time and would appreciate
any help in this regard.
Thanks in advance.
Vimal