Sub Test()
Selection.Collapse
Selection.Moveright unit:=wdCharacter, Extend:=True
If Selection.Font.Subscript Then
MsgBox "subscript = true"
End If
End Sub
I have to transform a chemical formular eg: H2O into a HTML compatile form
eg H<sub>2</sub>O.
So I have to find out if the number is a normal one or a subscript
And I'm not programming nativ Word but with VB2005 against the Word Object
Model, I thought this is the wright NG for this Problem... ( I hope so)
Sub Test1f()
Dim rdcm As Range
Set rdcm = ActiveDocument.Range
With rdcm.Find
.Font.Subscript = True
While .Execute
' rdcm.Select ' for testing
rdcm.Font.Subscript = False
rdcm.InsertBefore "<sub>"
rdcm.InsertAfter "</sub>"
Wend
End With
End Sub
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Vista Small Business, Office XP
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.