set document variable to Wingdings character

M

Mr_Tony_James

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.
 
H

Helmut Weber

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"
 
J

Jean-Guy Marcil

(e-mail address removed) was telling us:
(e-mail address removed) 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
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
M

Mr_Tony_James

Jean-Guy Marcil said:
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
 
J

Jean-Guy Marcil

(e-mail address removed) was telling us:
(e-mail address removed) nous racontait que :
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
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
C

champollion.yves

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
 
M

Mr_Tony_James

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?
 
J

Jean-Guy Marcil

(e-mail address removed) was telling us:
(e-mail address removed) 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
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jean-Guy Marcil

(e-mail address removed) was telling us:
(e-mail address removed) nous racontait que :

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
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top