Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

set document variable to Wingdings character

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mr_Tony_James@hotmail.co.uk - 26 Apr 2006 15:18 GMT
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.
Helmut Weber - 26 Apr 2006 15:38 GMT
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.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

Jean-Guy Marcil - 26 Apr 2006 15:51 GMT
Mr_Tony_James@hotmail.co.uk was telling us:
Mr_Tony_James@hotmail.co.uk nous racontait que :

> Hi all
>
[quoted text clipped - 12 lines]
>
> 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.

Signature

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

Mr_Tony_James@hotmail.co.uk - 26 Apr 2006 16:47 GMT
> I assume that in the document you will have something like this where you
> want the tick to appear:
[quoted text clipped - 4 lines]
> 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
Jean-Guy Marcil - 26 Apr 2006 17:21 GMT
Mr_Tony_James@hotmail.co.uk was telling us:
Mr_Tony_James@hotmail.co.uk nous racontait que :

>> I assume that in the document you will have something like this
>> where you want the tick to appear:
[quoted text clipped - 11 lines]
> it works!
> Many thank yous.

One is enough!
You're welcome!

Signature

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

champollion.yves@wanadoo.fr - 26 Apr 2006 23:03 GMT
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
Mr_Tony_James@hotmail.co.uk - 28 Apr 2006 14:07 GMT
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?
Jean-Guy Marcil - 28 Apr 2006 15:34 GMT
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?

Signature

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

Mr_Tony_James@hotmail.co.uk - 28 Apr 2006 18:50 GMT
In VBA.
Jean-Guy Marcil - 28 Apr 2006 23:34 GMT
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

Signature

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


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.