How to insert alternating Wingding unicode chars into a Macrobutto

M

Marceepoo

Sub SymbolCarousel()
' This is Bill Coan's macro.
' I wanna replace the N with an unchecked box (Wingding Font, Alt-0114), and
' I wanna replace the Y with a check'd box (Wingding Font, Alt-0253).
' The two macros beneath Bill Coan's macro generate the unicode characters,
' but I can't figure out how to put the chars into the macrobutton.
' I've looked at Microsoft Article ID : 78835 , but don't find the solution
there.
' Any ideas would be much appreciated. Thanks again, Marceepoo

Select Case Selection.Fields(1).Code.Characters(29)
Case "Y"
Selection.Fields(1).Code.Characters(29) = "N"
Case "N"
Selection.Fields(1).Code.Characters(29) = "?"
Case "?"
Selection.Fields(1).Code.Characters(29) = "Y"
Case Else
End Select

End Sub

Sub UnicohdCharInsrtCkBox()
'
With Selection
.Collapse Direction:=wdCollapseStart
.InsertSymbol CharacterNumber:=114, _
Font:="Wingdings", Unicode:=True
End With

End Sub
Sub UnicohdCharInsrtCkdBox()
With Selection
.Collapse Direction:=wdCollapseStart
.InsertSymbol CharacterNumber:=253, _
Font:="Wingdings", Unicode:=True
End With

End Sub
 
H

Helmut Weber

Hi,

somewhat tricky:

If your macrobutton field looks like this:
{ MACROBUTTON test2000 r }
make it look like this:
{ MACROBUTTON test2000 r}

Note that I have removed the last space!
And that there is a character "r". Character 114.

Code.character.count returns 25, !!!
even if there are 26 characters.
The "r" is therefore character 24.
Hide the field code.
Format the field as "Wingdings".

And off we go:
Sub test2000()
Dim n As Long
With Selection.Fields(1)
.Select
Selection.Font.Name = "Wingdings"
n = .Code.Characters.Count
Select Case .Code.Characters(n)
Case Chr(114)
.Code.Characters(n) = Chr(253)
Case Chr(253)
.Code.Characters(n) = Chr(114)
Case Else
End Select
End With
End Sub

Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 
M

Marceepoo

Lieber Helmut:

1. Danke. Der Code und die Erklärung waren schön. (I hope Google
translated the following text correctly: Thank you. The code
and the explanation were beautiful.)
2. Is it annoying or okay for me to just post a "thank you" when an MVP
such as yourself answers a question for me?
3. Which reminds me... I love the MVP site:
http://www.word.mvps.org/index.html
Are there any analogous MVP sites for:
1. vbscript?
2. asp?
3. etc.?
If "yes", how can I find them?
Thank you again, Marceepoo
 
H

Helmut Weber

Hi Marceepoo,
Lieber Helmut:
1. Danke. Der Code und die Erklärung waren schön. Perfect translation.
2. Is it annoying or okay for me to just post a "thank you"
when an MVP such as yourself answers a question for me?

Not at all. I asked the same question some years ago.
All posters love to here "thank you",
and a short notice, whether something worked, helps others, too.
3. Which reminds me... I love the MVP site:
http://www.word.mvps.org/index.html
Are there any analogous MVP sites for:
1. vbscript?
2. asp?
3. etc.?

I don't know.
Somebody else might know better where to direct you.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

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