Saturday, May 28, 2016

Declaring Multiple Variables

Declare each one


When setting up a macro in VBA, if you want to declare multiple variables in one line of code, be sure to specify the type for each variable, even if the variables are the same type. Avoid code like the following:

Dim strFName, strLName, strMI As String

In such a case, only the last variable, strMI, is actually declared as a String type. The first two variables are designated by default as Variant data types.

To correctly declare the three variables, you would use the statement:

Dim strFName As String, strLName As String, strMI As String


See all Topics

Saturday, May 21, 2016

Place Marker

If it's broke, fix it


To return to your last edit point, press Shift+F5. For instance, if you have copied and want to return to where you were in order to paste.

Press Shift+F5 again to go to up to the last three edit points, or a fourth time to return to where you started.

In Word 97 you could use this when you first open a document, to go straight back to where you last edited.

There was a change with 2000+ that broke this. The \PrevSel1 bookmark is destroyed when the document is saved.

The Word MVP site has a fix and some other interesting suggestions:

GoBack (Shift+F5) doesn't work in some newly-opened documents

Here are some more bookmarks:
Predefined bookmarks


See all Topics

Friday, May 13, 2016

Format Again by Keyboard

Shortcut to copy


This is one of those tips that you probable skimmed past some time ago.
Rather than using the Format Painter, here's a keyboard shortcut:
  1. Select the text with the formatting you want.
  2. Ctrl+Shift+C.
  3. Select the text to be formatted.
  4. Ctrl+Shift+V will paste the new formatting.
It's the Shift key that adds the functionality to our old friends Copy/Paste.


See all Topics

Thursday, May 05, 2016

Digital Signatures

How do I know it's real?


If you find a need to provide some sort of certification that your document has not been tampered with and is the real thing, you might consider a digital signature.

This Microsoft Support article discusses the process.
What is a digital certificate?

What is a digital signature?

What occurs when I use a digital signature?

What Word files can I sign?

How can I obtain a digital signature?
  • Method 1: Obtain a digital certificate from a certification authority
  • Method 2: Create your own digital certificate
    Description of digital signatures and code

    Here's information for Excel.

    Digital Signatures for Excel


    See all Topics