
:max_bytes(150000):strip_icc()/002-how-to-do-subscript-in-word-4174201-d89dd1e6eb10407492717221ba376174.jpg)
Superscript and subscript both affect the placement of text compared to other text in a document. Superscript and Subscript in Microsoft Word But what do these formatting options do? And how do you select them? In this post, we explain the basics. Microsoft Word has options to apply superscript, subscript, and strikethrough to text in a document. If yes, it's formatted as subscript, if it's another member, then no subscript.Superscript, Subscript and Strikethrough in Microsoft Word The code below checks whether the second member of the array is being written. You need to write a separate range object for each formatting variation. Important is "collapsing" the range so that the content is appended, rather than over-written. Use a Range object to write the data to the table cell. Please note how to declare and instantiate a Table object - this is more reliable and more efficient than repeating ActiveDocument.Tables. It's main purpose is to demonstrate how to insert text and format it, which is done in the For loop. Since you haven't provided a mvce you'll need to adapt the following example to your needs. How do I need to change my code to accomplish that? If the ws.Cells has for example a_b_c then b should be subscript and a and c normally written in the table cell. So what I actually want in my table cell is the following My current code should do that, however, it writes the value into the cell based on the last value of Font.Subscript, so either fully normal or fully subscript.

Only the second element of the array must be subscript. This can become an array of length 1,2 or 3 So I split the text that is in ws.Cells(i,j) on "_" ActiveDocument.Tables().Cell(i, j). = Falseįor k = LBound(wordArray) To UBound(wordArray)ĪctiveDocument.Tables().Cell(i, j).Range.InsertAfter wordArray(k)ĪctiveDocument.Tables().Cell(i, j). = wdToggle I currently have this code, it is a part of the loop in which I insert my values into the table. I am trying to add text as subscript in a Table Cell in a Word-Document using VBA.
