Hi all

Word 2003 on XP Pro. Does anyone know how to set the value of a
document variable to a Wingdings 2 character?

My existing code is:
ActiveDocument.Variables("required").Value = "Yes"

I'd like to replace the "Yes" with a tick symbol (character number
-4016) from the Wingdings 2 font.

Have tried:
ActiveDocument.Variables("required").Value = ChrW(-4016) but it gives a
box symbol.

Is this possible or is there another way? Thanks.

Re: set document variable to Wingdings character by Helmut

Helmut
Wed Apr 26 09:38:04 CDT 2006

Hi Mr_Tony_James,

IMHO, no way.

Variables don't know anything about formatting.

You may use "P" instead.

And you'll know about the drawbacks, I guess.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Re: set document variable to Wingdings character by Jean-Guy

Jean-Guy
Wed Apr 26 09:51:05 CDT 2006

Mr_Tony_James@hotmail.co.uk was telling us:
Mr_Tony_James@hotmail.co.uk nous racontait que :

> Hi all
>
> Word 2003 on XP Pro. Does anyone know how to set the value of a
> document variable to a Wingdings 2 character?
>
> My existing code is:
> ActiveDocument.Variables("required").Value = "Yes"
>
> I'd like to replace the "Yes" with a tick symbol (character number
> -4016) from the Wingdings 2 font.
>
> Have tried:
> ActiveDocument.Variables("required").Value = ChrW(-4016) but it gives
> a box symbol.
>
> Is this possible or is there another way? Thanks.

I assume that in the document you will have something like this where you
want the tick to appear:

{DOCVARIABLE required}

Select that bit and apply the Windings 2 font to see the "tick" instead of
the "square." You get a square because in the Times font (Or Arial, or
whatever font you are using), ChrW(-4016) is not represented.

There a some font/unicode experts around here, if they happen to be around,
I am sure they can explain it all better than I can.

If you have other font issues, you could also post in the word.printingfonts
group.


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org



Re: set document variable to Wingdings character by Mr_Tony_James

Mr_Tony_James
Wed Apr 26 10:47:06 CDT 2006

Jean-Guy Marcil wrote:
>
> I assume that in the document you will have something like this where you
> want the tick to appear:
>
> {DOCVARIABLE required}
>
> Select that bit and apply the Windings 2 font to see the "tick" instead of
> the "square." You get a square because in the Times font (Or Arial, or
> whatever font you are using), ChrW(-4016) is not represented.
>

Jean_Guy

Yes you're correct in your assumption. I've tried your technique and
it works!
Many thank yous.

Tony


Re: set document variable to Wingdings character by Jean-Guy

Jean-Guy
Wed Apr 26 11:21:10 CDT 2006

Mr_Tony_James@hotmail.co.uk was telling us:
Mr_Tony_James@hotmail.co.uk nous racontait que :

> Jean-Guy Marcil wrote:
>>
>> I assume that in the document you will have something like this
>> where you want the tick to appear:
>>
>> {DOCVARIABLE required}
>>
>> Select that bit and apply the Windings 2 font to see the "tick"
>> instead of the "square." You get a square because in the Times font
>> (Or Arial, or whatever font you are using), ChrW(-4016) is not
>> represented.
>>
>
> Jean_Guy
>
> Yes you're correct in your assumption. I've tried your technique and
> it works!
> Many thank yous.

One is enough!
You're welcome!

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org



Re: set document variable to Wingdings character by champollion

champollion
Wed Apr 26 17:03:43 CDT 2006

The problem appears when you actually plough back that character into
the document

Try something like

Selection.InsertSymbol CharacterNumber:=-4016, Font:="Wingdings
2", Unicode:=True

which IMO is the canonical way of inserting critters like bullets,
symbols, etc. into a document.

Cheers,
Yves Champollion
www.champollion.net


Re: set document variable to Wingdings character by Mr_Tony_James

Mr_Tony_James
Fri Apr 28 08:07:36 CDT 2006

I appreciate your help. Won't that replace the DOCVARIABLE field in
the document with the tick symbol though? I need to keep the field.

Also how to select a DOCVARIABLE field in a document using the name of
the DOCVARIABLE?


Re: set document variable to Wingdings character by Jean-Guy

Jean-Guy
Fri Apr 28 09:34:25 CDT 2006

Mr_Tony_James@hotmail.co.uk was telling us:
Mr_Tony_James@hotmail.co.uk nous racontait que :

> I appreciate your help. Won't that replace the DOCVARIABLE field in

Yes.

> the document with the tick symbol though? I need to keep the field.
>
> Also how to select a DOCVARIABLE field in a document using the name of
> the DOCVARIABLE?

What do you mean by "Select"?

From the UI? Through VBA? Something else?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org



Re: set document variable to Wingdings character by Mr_Tony_James

Mr_Tony_James
Fri Apr 28 12:50:15 CDT 2006

In VBA.


Re: set document variable to Wingdings character by Jean-Guy

Jean-Guy
Fri Apr 28 17:34:38 CDT 2006

Mr_Tony_James@hotmail.co.uk was telling us:
Mr_Tony_James@hotmail.co.uk nous racontait que :

> In VBA.

Look at the Code property of the Field object, it returns the string
representing the field code.

So, you could do something like:

Dim myField As Field

For Each myField In ActiveDocument.Fields
If InStr(1, UCase(myField.Code), UCase("DOCVARIABLE")) > 0 Then
myField.Result.Select
MsgBox "This is a DocVariable field!"
End If
Next


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org