Link to home
Start Free TrialLog in
Avatar of irina_1973
irina_1973

asked on

Subscript and Unicode text to the Word from VB

It's seem to me very difficult.

I created a Word Document from VB.
Now I want to insert some text ,for example "Ak".
But to insert "k" subscript . How can I do it from VB.

And maybe somebody know how to insert also Unicode char to the word from VB.(for example U+2113 -small l)

Please ,help me !
Avatar of bullethead
bullethead
Flag of United Kingdom of Great Britain and Northern Ireland image

Something like this should give you the idea.

Sub Insert_Text()

Dim appWd As Word.Application
Set appWd = GetObject(, "Word.Application")
   
With appWd.Selection
    .TypeText Text:="A"
    .Font.Subscript = wdToggle
    .TypeText Text:="k"
    .Font.Subscript = wdToggle
End With

End Sub

Not sure about the Unicode char, to insert it using the Decimal ASCII code you can use Chr, for example:

Selection.TypeText Chr(105)
ASKER CERTIFIED SOLUTION
Avatar of lvngstn
lvngstn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lvngstn
lvngstn