1
votes

I am using unicode "fonts" (Segoe UI Symbol) instead of clip art/icons in an instructional document table. I can't figure out how to make the unicode icon "pretty" using VBA. When recording my macro, I navigate to: Home | Font | text effects and typography | Fill - olive green, Accent 3, sharp bevel > and NOTHING gets recorded. :(

I've figured out how to insert the unicode symbol:

Selection.InsertSymbol Font:="Segoe UI Symbol", CharacterNumber:=9745, 
Unicode:=True
Selection.Font.Size = 40

What I can't figure out is how to make it pretty. I tried to do something like this to no avail:

With ActiveDocument.Styles("UnicodeIcon").Font
    .Name = "Segoe UI Symbol"
    .Size = 40
    .Outline = True
    .Emboss = True
    .Shadow = True
    .Color = 15908096 'I need it this color
    .Engrave = True
End With

I hope to share this template with trainers who simply need to select Developer | Macros | select the macro | press RUN and VBA will insert a font/icon in the right size and color, AND it will change it from a boring flat image to appearing multidimensional.

1
How about providing the formatted symbol in the template as a Building Block, then use the macro to insert the Building Block?Cindy Meister
Are you able to create the style you propose in the "pseudocode" manually? Also, I don't find the commands you list - which version of Word are you using? And/or inlcude a screen shot.Cindy Meister
Explore the properties available for Selection.Font.TextShadowCindy Meister

1 Answers

0
votes

When you said building block - that got my squirrel brain pin balling around. I realized I was trying to add a Unicode icon and then customize it with VBA, completely neglecting all the fantastic built in properties of a style... So:

(1) With "record on", I inserted an icon on my page (Insert | Symbols | Symbol) so I could get the character number and syntax.

(2) With "record off" ... I customized the icon on my page (Home | Font | Text Effects & Typography) and updates parts of it to meet my needs.

(3) I added a NEW STYLE to my Word template and called it: UnicodeIcon.

(4) I selected my icon then using the drop down in Styles, selected "Update UnicodeIcon to match my selection". The best part is, this way it captured Bevel.

(5) I took the recorded piece (step 1) and cut/paste into the rest of my macro and now it runs without having to include any "with" formatting statements (because it is all built into the style), e.g.:

'insert unicode icon for STEP 1 - Information

Selection.Style = ActiveDocument.Styles("UnicodeIcon")
Selection.InsertSymbol Font:="Webdings", CharacterNumber:=-3991, Unicode:=True

I don't particularly like having lots of customized styles, but it works and you got me going in the right direction! Thanks! ♥