web 2.0


Microsoft Word Outline

Sometimes, we have a very large document in Microsoft Word and need to move sections of the document around. In order to move such document sections, people often copy and paste. However, this is inneficient when dealing with large documents.

Here's a video a made explaining how to handle that (URL: http://www.youtube.com/watch?v=ArfgwtAzx74):

Tags: ,

Microsoft Word

Word 2007 random text

The other day I had to teach a Word course and I normally take a text with me so that people can replicate what is being taught. This time, however, I decided to use an old trick from Word whereby you can use the =rand() function to get the following:

On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document. You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks. When you create pictures, charts, or diagrams, they also coordinate with your current document look.

You can easily change the formatting of selected text in the document text by choosing a look for the selected text from the Quick Styles gallery on the Home tab. You can also format text directly by using the other controls on the Home tab. Most controls offer a choice of using the look from the current theme or using a format that you specify directly.

To change the overall look of your document, choose new Theme elements on the Page Layout tab. To change the looks available in the Quick Style gallery, use the Change Current Quick Style Set command. Both the Themes gallery and the Quick Styles gallery provide reset commands so that you can always restore the look of your document to the original contained in your current template.


Besides the traditional =rand() function, we can also use the =lorem() function to return the ubiquitous "Lorem ipsum..." text:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna.

Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus.

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede. Mauris et orci.


In both cases we get a set of three paragraphs, but you can change that by adding arguments to the functions. If you type =lorem(6) you will get six paragraphs whereas if you type =lorem(3,6) you will get three paragraphs with six sentences each.

========
PS: You can also use this in other Office applications such as PowerPoint. Enjoy!

Tags: , ,

Microsoft Word

Adding a serial number to a Word document

This tip shows how to add a serial number to a Word document using VBA. The number is updated everytime the file is opened...

Private Sub Document_Open()
  Set myCell = ThisDocument.Tables(1).Cell(Row:=1, Column:=1)
  nSerial = Left(
myCell.Range.Text, Len(myCell.Range.Text) - 2)
  If nSerial = "" Then nSerial = 0
  ThisDocument.Tables(1).Cell(Row:=1, Column:=1).Range = nSerial + 1
  ThisDocument.Save
End Sub

Tags: , ,

Microsoft Word | Microsoft Word - VBA

Paste Excel range into a Word document using VBA

In this tip you learn how to copy a range from Excel and paste into a Word document. This is a very simple process which does not require much technical knowledge.

I chose to use a generic object rather than a Word object because it does not require the reference of object libraries. The late binding implies a delay, but you can add the reference to the Word library if you wish!

Sub PasteIntoWordDocument()

  Dim oWord As Object
  Dim oWordDoc As Object
  Dim oRng As Excel.Range

  On Error Resume Next
  Set oWord = GetObject(, "Word.Application")
  If Err <> 0 Then Set oWord = CreateObject("Word.Application")

  On Error GoTo
Err_Handler
  Set oRng = Application.InputBox("Select the data range...", , , , , , , 8)

  oRng.Copy
  Set oWordDoc = oWord.Documents.Add
  oWord.Visible = True
  oWordDoc.ActiveWindow.Selection.Paste

  Set oWordDoc = Nothing
  Set oWord = Nothing
  Set oRng = Nothing

  If Err = 0 Then MsgBox "Pasting into Word document was successful!", vbInformation

  Exit Sub
Err_Handler:
  MsgBox Err.Description, vbCritical, Err.Number
  Resume Next
End Sub

Tags: , ,

Microsoft Excel | Microsoft Excel - VBA | Microsoft Word