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

Office 2007 CustomUI GroupAddInsCustomToolbars

For many people out there, who have written AddIns for Excel using VB6, they find themselves with a dilemma: how do I add my custom toolbar to another Ribbon tab?

Well, I honestly do not have an answer to that question; however, we can still customize the Ribbon and move this Custom Toolbar to another location. To be specific, we can move it to the QAT (Quick Access Toolbar).

First off, you need to add your custom toolbar. You can use VBA to add this custom toolbar as follows:

Sub test()
    Dim cmdBar As CommandBar
    Dim btn As CommandBarButton

    On Error Resume Next
    Application.CommandBars("Testing").Delete()
    cmdBar = Application.CommandBars.Add
    cmdBar.Name = "Testing"
    cmdBar.Visible = True

    btn = cmdBar.Controls.Add(Type:=msoControlButton)

    With btn
        .Style = msoButtonIconAndCaption
        .FaceId = 986
        .Caption = "Robert Martim"
    End With
End
Sub


The above code will add the following to the Add-Ins tab:

Now, you create your other Excel document where you wish to add the GroupAddInsCustomToolbars to it. Open this Excel document using the custom UI Editor where the following XML must be inserted:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"

      xmlns:mso="http://schemas.microsoft.com/office/2006/01/customui">

      <ribbon startFromScratch="true">

       <qat>

        <documentControls>

         <mso:control idQ="mso:GroupAddInsCustomToolbars" visible="true"/>

        </documentControls>

       </qat>

      </ribbon>

</customUI>

The GroupAddInsCustomToolbars is placed under the mso namespace; therefore we must refer to it and then get the idQ for it. Remember that GroupAddInsCustomToolbars is not a group per se, but a control (it is a commandbar control). Hence, if you try to place it under a tab, it fails since it cannot find the group.

Also, remember that to customize the QAT you must start from scratch. The final result is:

Tags: , ,

Microsoft Excel - VBA

Excel Highlight the Active Cell

In a video (http://www.youtube.com/watch?v=bGjqDGF7xaM) published on YouTube back in 2008, I explained how to highlight the active row in Excel. In this brief article, I discuss how you can highlight the active cell in Excel. In this particular case, I will only change the font color of the cell, but you can later change the conditional formatting and apply whatever formatting you wish.

Here's how it is done:

1. Create a named range called AddressOfActiveCell using the formula: =ADDRESS(5,6)
2. Select the entire worksheet and apply a conditional formatting using the formula (the active cell being A1 upon selection): =ADDRESS(ROW(A1),COLUMN(A1))=AddressOfActiveCell
3. Now, open the visual basic editor and insert the following code:


Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)

    With ThisWorkbook.Names("AddressOfActiveCell"
)
        .Name =
"AddressOfActiveCell"
       
.RefersToR1C1 = "=address(" & ActiveCell.Row & "," & ActiveCell.Column &
")"
   
End
With

End
Sub

Check the video tutorial here:

Tags: , , , , ,

Microsoft Excel - VBA

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