Skip to Page Content

Tips\typing\Word macros for super and subscript tags

From WolfWikis

Jump to: navigation, search

Superscripts and subscripts are a bit tedious in wiki because they require the <sub></sub> and <sup></sup> tags. I wrote two little macro’s that will put the tags around a highlighted (selected) text in Word 2003.

Sub qwe() Dim txt As String txt = Selection txt = "<sub>" & txt & "</sub>" Selection.TypeText Text:=txt End Sub Sub qwe2() Dim txt As String txt = Selection txt = "<sup>" & txt & "</sup>" Selection.TypeText Text:=txt End Sub

To implement the macro’s hit Alt+F11 in Word and Insert a macro into the Normal workbook (There should be a little window on the left showing the Normal and there is a menu at the top of the page that contains insert). Copy two above subs from the edit page of the page you are looking at and paste them in the new window that opens in the VBA editor. Go to file and save the normal. Then click the W icon to go back to Word.

Point at any icon above the page an right click. Opt for customize at the bottom of the pop up. Scroll the left scroll bar until you see macros and single click it. Then scroll the right bar until you see Normal.NewMacros.qwe. Click it and click on the Keybord button. On the pop up left scroll until you see macros and then right scroll until you see qwe again. Then type a convenient shortcut for the macro in the shortcut box (e.g. Ctrl+Alt+=).

Once saved, highlight a piece of text and hit the shortcut.

Using the same menus you can also create a button icon for the macro if you wish


Wiki Stats

Users:  7,206
Pages:  3,945
Uploads:  4,767
Views:  4,511,005
Edits:  92,128