Group:  Microsoft Word ยป microsoft.public.word.mailmerge.fields
Thread: How to get the values for Comparison,CompareTo and TrueAutoText

Geek News

How to get the values for Comparison,CompareTo and TrueAutoText
Sunil Sudhakaran 10/14/2008 4:31:03 PM
I have a Document that is having many Field codes.

I would like to extract the following information from the if field.

{ if {MERGEFIELD Version} = "CustomerA" "contact abc[ at ]gmai.com"}

I tried using MailMergeField.Next.Code got the Condition, not able to get
other values

Dim doc As Document
Dim fld As MailMergeField
Set doc = ActiveDocument
For Each fld In doc.MailMerge.Fields
........
If fld.Type = wdFieldIf Then
..........
MsgBox fld.Next.Code
End if

How to get the values for Comparison,CompareTo and TrueAutoText

Regards
Sunil S.
Re: How to get the values for Comparison,CompareTo and TrueAutoText
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 10/14/2008 7:34:36 PM
Sorry, I do not understand what you are trying to do.

{ if {MERGEFIELD Version} = "CustomerA" "contact abc[ at ]gmai.com"}

should return "contact abc[ at ]gmai.com" IF the Version field contains
"CustomerA" AND you used Ctrl+F9 to insert the field delimiters { }

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Sunil Sudhakaran" <SunilSudhakaran[ at ]discussions.microsoft.com> wrote in
message news:A3439FE0-6870-4B1D-8B7E-73EDBA73019F[ at ]microsoft.com...
[Quoted Text]
>I have a Document that is having many Field codes.
>
> I would like to extract the following information from the if field.
>
> { if {MERGEFIELD Version} = "CustomerA" "contact abc[ at ]gmai.com"}
>
> I tried using MailMergeField.Next.Code got the Condition, not able to get
> other values
>
> Dim doc As Document
> Dim fld As MailMergeField
> Set doc = ActiveDocument
> For Each fld In doc.MailMerge.Fields
> ........
> If fld.Type = wdFieldIf Then
> ..........
> MsgBox fld.Next.Code
> End if
>
> How to get the values for Comparison,CompareTo and TrueAutoText
>
> Regards
> Sunil S.


Re: How to get the values for Comparison,CompareTo and TrueAutoText
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 10/14/2008 11:35:23 PM
I don't think Word provides any any properties or functions that will
extract these parts of the IF field for you, and I suspect it will be quite
complicated to do it yourself. I certainly do not have code to do it.

For one thing, I doubt that

MsgBox fld.Next.Code

is giving you the full Condition (i.e. '{ MERGEFIELD Version } = "Customer
A"' ), just the next MERGEFIELD. And the problem is that the first part of
the condition is not necessarily even a field. Or it might be a nested
field. The result areas can also contain almost anything - text, fields,
including further IF statements, inline graphics etc. They may or may not be
wrapped in double quotes, and so on.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Sunil Sudhakaran" <SunilSudhakaran[ at ]discussions.microsoft.com> wrote in
message news:A3439FE0-6870-4B1D-8B7E-73EDBA73019F[ at ]microsoft.com...
[Quoted Text]
>I have a Document that is having many Field codes.
>
> I would like to extract the following information from the if field.
>
> { if {MERGEFIELD Version} = "CustomerA" "contact abc[ at ]gmai.com"}
>
> I tried using MailMergeField.Next.Code got the Condition, not able to get
> other values
>
> Dim doc As Document
> Dim fld As MailMergeField
> Set doc = ActiveDocument
> For Each fld In doc.MailMerge.Fields
> ........
> If fld.Type = wdFieldIf Then
> ..........
> MsgBox fld.Next.Code
> End if
>
> How to get the values for Comparison,CompareTo and TrueAutoText
>
> Regards
> Sunil S.

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net