Showing posts with label MS Word. Show all posts
Showing posts with label MS Word. Show all posts

20 September 2018

MS Word - Another use for Ctrl+z

Quite a number of articles giving tips and tricks on MS Word advice turning off automatic formatting when users get frustrated and want to stop MS Word from changing certain things that they type, for example, three dashes turning into a horizontal line, or automatically converting to the copyright symbol after typing (c).

There's a simpler solution without the need to go through all the hassle of turning automatic formatting off.

Just undo the typing, or Ctrl+z (the keyboard shortcut).

And next time if you need the horizontal line fast, you can still do it the three dashes way.




15 September 2018

Filler Text for MS Word

Have you come across instances when you need filler text for your MS Word documents, especially when creating templates?

Instead of going to the browser, find a lorem ipsum generator, generate the text, copy, and then going back to MS Word and pasting it, you can do it in just one step. Type "=lorem(p,l)" in your document, where "p" == the number of paragraphs and "l" == the number of lines to generate.

And hit Enter.

Viola! It's like magic.


19 May 2018

MS Word VBA - Remove Cross Reference Links


Those who use MS Word extensively would likely have come across docs that use the cross-reference link feature.

And sometimes, due to the document passing through many hands, and when it finally comes to you, you find that the cross-reference links are all in a mess, sometimes with Error! messages here and there.

Someone came to find me the other day, and his question was - Could you help me remove the cross-reference links, just the links, but retain the words?

Ok, so I searched the web, and saw a seemingly nifty solution: Ctrl+A, and then Ctrl+Shift+F9

We happily used this, only to find out moments later that the references for all the Figure and Table Captions were all gone as well! This meant that we are no longer able to create a List of Tables/Figures, and that if more tables and figures are to be added, we have to MANUALLY update all the table and figure numbers. Imagine the nightmare with over 100 of them, each. That's a total of more than 200. Gosh.

In desperation, I sought a solution via VBA. After much trial and error, I managed to come up with this. May this help anyone who needs it.

Sub RemoveCrossRefLink()
  Dim objDoc As Document
  Dim objFld As Field
  Dim sFldStr As String
  Dim i As Long, lFldStart As Long

  Set objDoc = ActiveDocument
  ' Loop thru fields in the doc
  For Each objFld In objDoc.Fields
     If objFld.Type = wdFieldRef Then
        objFld.Select
        Selection.Fields.Unlink
        objFld.Update
     End If
  Next objFld
End Sub