Processing
 

numericals in word macro

20/09/2016 09:34#1

Joined at: 4 months ago

Post: 2

Thank: 0

Thanked: 0

I have the task of finding numeric in a word document and alternatively superscript and subscript them. right now I can search for all the numbers found in the document and superscript all of them and then manually subscript them alternatively. using this

Next i      .Text = "[0-9]{1,}"      .Replacement.Text = "^&"      .Replacement.Font.Superscript = True      .Execute Replace:=wdReplaceAll, MatchWildcards:=True  End With 

Is there any way I can select every single character in the document and one by one the macro sees if it is a number or not and subscripts or superscripts alternatively

example Text - " [17] Saied, M.H., Mostafa, M.Z., Abdel-Moneim, T.M., Yousef, H.A.: On Three Phase Six- Switches Voltage Source Inverter: A 150° Conduction Mode. Member IEEE, Alexandria Univercity (2006)"

now in tis example the macro would have to make 17 superscript and 150 subscript and 2006 as superscript..

Please someone help me with this

20/09/2016 14:01Top#2

Joined at: 8 months ago

Post: 7

Thank: 0

Thanked: 0

You could use Range.Characters to loop over the characters. Something like

Dim chr As Range For Each chr In ActiveDocument.Range.Characters     If IsNumeric(chr.Text) Then chr.Font.SubScript = True Next chr 

Then add some booleans that tell you if you have to set it to sub- or superscript

Similar articles

VBA regex matching over two lines

4 months ago - Reply: 1 - Views: 44

Table output to Word-2011 from Rstudio using knit

4 months ago - Reply: 0 - Views: 28

Write a Collection of paragraphs into a new document

4 months ago - Reply: 1 - Views: 70

how to write paragraphs without show to document

4 months ago - Reply: 1 - Views: 66

numericals in word macro

4 months ago - Reply: 1 - Views: 45

Can not find proofing tools

4 months ago - Reply: 0 - Views: 1

Possible values for <w:outlineLvl> in Word OOXML

4 months ago - Reply: 1 - Views: 7

C# restrict editing partial word paragraph

5 months ago - Reply: 2 - Views: 142

Macro translation Please (possible virus)

4 months ago - Reply: 1 - Views: 34

Doc/Docx Fastest Reading Method for Searching

4 months ago - Reply: 0 - Views: 1

Save embedded file / content from word

4 months ago - Reply: 0 - Views: 5

Counting words in Word document, including footnores

4 months ago - Reply: 1 - Views: 22

c# access extract word ole object

4 months ago - Reply: 1 - Views: 19

Using word wildcards to find unaccepted changes

4 months ago - Reply: 1 - Views: 45

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re