« Update to OneNote Virtual PowerToy | Main | Taming Your E-mail Inbox, Tip #1 »

Tuesday, September 28, 2004

“While You Were Out” Outlook Addin

Sometimes I am amazed at what software developers omit in their software. For example, you would think that Outlook would offer a simple way for a user to take a phone message. Sure, you can just send an e-mail. Or, if you are trying to implement David Allen’s Getting Things Done system, you can have your assistant enter a task and assign it to the “@Calls” category, so it shows up in your Outlook task list.

This latter is the approach I used to take, until I realized I was missing important messages. In the hustle and bustle of the daily grind, I sometimes wouldn’t get a chance to check my task list for several hours. What I really wanted was both: I wanted an e-mail notification that I had received a message, and, if I needed to return the call, I wanted a task entered into my Outlook task list. This sounded like the perfect opportunity for me to write a simple Outlook VBA program to make this easy on my assistant and easy on me. (I know, I know, the President of a company shouldn’t be writing code, but I consider it a hobby and do it on my own time!)

The result is what I call “While You Were Out” (“WYWO” for short). It provides the user with the opportunity to take a message, capture all the relevant information, and send it on to the intended recipient. It’s written in VBA, which means there’s not an elegant way to deploy it. As a result, I will have to give you detailed instructions for installing it and getting it running. I will do that at the end of this post. But first, let me go over a few of the features, so you can make sure this is something you want to take the time to install.

Features

When you install WYWO, you will copy a custom button image to an Outlook toolbar and attach the VBA program to it. My toolbar looks like this:

When you click on the icon, you get a dialog box that looks like this:

Hopefully, most of the fields are self-explanatory. I was able to get the two assistants in our executive office running on it with about two minutes of explanation. However, let me point out a few of the features:

  • The Date field uses the standard drop-down calendar. The Time field also uses this, but it is formatted to display the time. Both fields default to the current date and time.

  • The To field can be set to a default value, using the Settings button at the bottom of the form. (More about that in a minute.) You can either manually enter a name in the Outlook format or an e-mail address. Alternatively, you can click on the To… button (just like the Outlook e-mail message form) and you will get a Select a Recipient dialog box with all your Outlook contacts. If you make a selection, the To field will be filled with your selected value. The CC field works the same way.

  • The Type field has three possible values: “Voice Mail,” “Live Call” (you actually talked with the caller) and “Came By” (referring to a drop-in visitor). You can select a default value in the Settings dialog.

  • The Urgency field also has three possible values: “Normal,” “High,” and “Low.” The program uses your selection to set the Importance level of both the e-mail message you send to the recipient and the (optional) task you create.

  • The Caller and the Company fields are self-explanatory. The Phone field is set up to automatically format the field. Just enter the raw numbers without entering any parenthesis or hyphens. When you exit the field, the program will automatically format it. You can enter a default Area Code and phone Prefix in the Settings dialog. (This is a good thing to do the first time you use the program.) Once you do that, if you enter a four-digit number, the program will automatically add the default area code and prefix. If you enter a seven-digit number, the program will automatically add the default area code. If you begin the number with the international prefix of “011,” the program will leave the number unformatted. The Ext field is optional and is for a phone extension.

  • The Action You Have Taken or Will Take group both encourages the user to take an action regarding the call (as opposed to just passing on the message) and also gives them the opportunity to tell you exactly what they have done. The Notes field provides them with additional space to elaborate if necessary.

  • The Action Recipient Needs to Take gives the user an opportunity to explicitly specify what action is required by the recipient. And, again, the Notes field provides the user with additional space to elaborate. In the event that the user selects the option, “You must speak personally with the caller,” the program also creates an Outlook task for the recipient. (The recipient must have access to the recipient’s task folder for this to work; otherwise, the program will generate an error. However, the program will trap this, so it doesn’t crash. The user will be warned, and the task will not be created. The e-mail will be sent as usual.) This can also be adjusted in the Settings dialog box.

When the user clicks on the Send button, the program builds an e-mail message with all the relevant data and sends it to the user. As I mentioned in the last bullet above, the program also creates an Outlook task if the recipient must personally return the call. A default category for the task can also be set in the Settings dialog box (by default it is the GTD standard, “@Calls”).

The tag on the subject line—“WYWO”—allows you to create an e-mail rule that will be triggered by these messages. For example, you could play a specific sound or display a visual alert when you receive a WYWO message. If your assistant is also receiving copies (e.g., as a CC recipient), he or she could create a rule that will automatically move the message to a “Phone Log” folder. In addition, if necessary, the program generates an Outlook Task like the following one under the @Calls category:

The contents of the WYWO Notes field are also copied to the Notes field in the Outlook Task. I won’t go over the Settings dialog; I think it is self-explanatory.

Installation

Unfortunately, as I mentioned previously, there’s not an easy way to deploy a VBA program. Before you go through this process, let me make a little disclaimer:

This program was developed on Windows XP and Outlook 2003. I have not tested it on earlier versions of Windows or Outlook. Also, I consider this “alpha” software. It has not yet been beta-tested. If you use this program, consider yourself a “guinea pig.” You may find significant bugs. (Please report them to me. Before you do, see the bottom of this article for any updates.) Therefore, it may not work or may not work as expected. If you install and use this program, you do so at your own risk! I accept no responsibility for any damages or lost time you experience as a result of installing this program and using it. You’re on your own.

So, with that aside, here are the step-by-step installation instructions:

  1. Download and install Redemption. You can find it here. This program allows WYWO avoid the constant Outlook security prompts when another program is trying to access Outlook e-mail. WYWO will not work without this module installed. Unzip the downloaded files into c:\Program Files\Redemption and double-click on the Install.exe file. This will automatically install Redemption.dll on your computer.

  2. Download “While You Were Out.”You can find it here. Unzip the downloaded files into c:\Program Files\WYWO.

  3. Load Microsoft Outlook. Again, as a reminder, I have only tested this program on Outlook 2003. Once Outlook is loaded, press Alt-F11 to bring up the Visual Basic Editor.

  4. Import the WYWO components. On the upper left-hand side of the screen, you should see a Project window that looks similar to this:
  5. Select File | Import File (or press Ctrl-M). Browse to the c:\Program Files\WYWO folder and then import frmAbout.frm, frmSettings.frm, frmWhileYouWereOut.frm, and WhileYouWereOut.bas. Now save the VBA Project file by selecting File | Save VBAProject.OTM or by pressing Ctrl-S. Now close the Visual Basic Editor by selecting File | Close and Return to Microsoft Office Outlook or press Alt-Q.

  6. Copy the WYWO button image to the Windows clipboard. You will need this for the next step. You can do this by opening Microsoft Paint (choose Start | All Programs | Accessories | Paint). Open the Toolbar.ico file. It should be located in your c:\Program Files\WYWO folder. Now choose Edit | Select All and then Edit | Copy. This will put the button image on the Windows clipboard. You can now close Paint.

  7. Install a macro button to run the WYWO program. Select Tools | Customize. This should bring up the Customize dialog box. Now click on the Commands tab. Click on the Macros category in the Categories list box. You should now be looking at a screen similar to this:



    Now click on the macro that is named “DisplayWhileYouWereOut.” Note that this may or may not be proceeded by the word “Project1” (as above). Now drag the macro to the toolbar. It doesn’t matter where you place it; you can put it anywhere you want. (As you can see from the screen shot at the beginning of this article, I placed mine just to the right of the Forward button.) Now right-click on the button itself. You should get a context menu that looks similar to this:



    In the Name field, replace the name of the macro with “While You Were Out.” This will become a “tool tip” when you later point at the button with the mouse. Now click on Paste Button Image. This will replace the default button image with the WYWO button image. Select Default Style, which will eliminate the text next to the button. Now close the Customize dialog box by clicking on the Close button. You’re done!

The first time you run the macro, you may get an Outlook Security warning. If so, follow the prompts to indicate that “Michael S. Hyatt” is a “Trusted Publisher.” (I have digitally signed the macro for this purpose.) Also, the first time you run the program, click on the Settings command button and enter your default values. Hopefully, you will find this program useful. If you like to dabble in writing VBA code, I think you will find the source code particularly interesting. I’m not a professional programmer, but perhaps you can learn from my work. I have tried to thoroughly document the code, so that you can more easily understand it.

Update: Some users have reported an error message to the effect that the “DTPCallDate variable is not defined.” If you get this message it is because an ActiveX control that the program uses is not installed on your system. Here’s how to install it:

  1. Make sure that Outlook is not running. Close it down if necessary.

  2. Download the control by clicking on this link: MSCOMCT2.OCX.

  3. Save the file to your c:\windows\system32 folder.

  4. Register the file in Windows by clicking Start | Run. In the Open field, type “regsvr32 c:\windows\system32\mscomct2.ocx” (without the quote marks). You should get a message that says, “DLLRegisterServer in c:\windows\system32\mscomct2.ocx succeeded.”

Now start Outlook and try to run WYWO again.

September 28, 2004 at 04:22 AM in Getting Things Done, Microsoft Outlook | Permalink

Comments

I installed this add-in following the instructions above. During step #4 while importing "frmWhileYouWereOut.frm" I got the following Microsoft Forms error message: Could not load some objects because they are not available on this machine." I completed the installation. However when I click the button in Outlook nothing appears to happen, except for the first instance when the little hourglass flips for a few seconds and then nothing?

I'm running Windows XP Pro, Outlook 2003 in an exchange server environment (on a notebook sometimes connected and sometimes not connected).

Any ideas?

Larry

Posted by: Larry | Nov 29, 2004 12:35:17 PM

Michael, your WYWO utility looks fascinating, but I noticed you didn't provide any tips on how to COMPLETELY un-install it if (no, when) it creates conflicts with Microsoft's incredibly temperamental OL. Any finishing tips that way?

Thanks!

/jh
Denver

Posted by: personaPM | Dec 4, 2004 11:30:52 AM

To uninstall it, open the Outlook Editor as I describe in the article. Right-click on the forms and delete. Then right-click on the WhileYouWereOut module and delete. If you attached the macro to a toolbar icon, right-click on the toolbar and select Customize. Then right-click on the WYWO icon and select Delete. That's all there is to it. Thanks.

Posted by: Michael Hyatt | Dec 4, 2004 12:38:47 PM

Same Problem as Larry above: I installed this add-in following the instructions above. During step #4 while importing "frmWhileYouWereOut.frm" I got the following Microsoft Forms error message: Could not load some objects because they are not available on this machine." I completed the installation. However when I click the button in Outlook nothing appears to happen, except for the first instance when the little hourglass flips for a few seconds and then nothing?

Any help would be greatly appreciated.

Thanks
Jack

Posted by: Jack | Dec 8, 2004 7:09:10 PM

I installed the utility and added it to my toolbar (right next to my FORWARD button). I receievd an error when I first tried to use it, and so I installed the OCX. Then, I restarted Outlook. Now, I cannot launch the WYWO macro at all.

Posted by: Darren | Dec 15, 2004 8:18:03 AM

I had the same problem - installing the OCX and not getting the add-in to run. I followed the directions for uninstalling the macro and then I found the file "vbaproject.otm" in the "C:\documents and settings\user name\application data\microsoft\outlook" folder (user name is whatever user you have installed under)and deleted the file. Then when you reopen Outlook - follow the directions for installing. The macro worked this time.

From now on I will make sure a computer has the OCX file BEFORE I try to install the add-in.

Posted by: Scott Bean | Dec 29, 2004 5:33:36 PM

Great idea but when I click the "To ..." the debugger loads and highlights the line "Function GetOneName(strDefaultValue As String) As String"

Any ideas?

Posted by: Terry Bennett | Jan 29, 2005 3:51:44 PM

I too had the problem of the macro not running after restarting Outlook. I tried the above suggestion (OCX) but still can't get it to run after restarting Outlook. Too bad...it would have been just what I was looking for!

Posted by: Steve Hess | Jan 30, 2005 11:22:23 AM

Michael,
Great utility. I was getting ready to write my own until I came across yours. There is a problem with executing the "To" part of the form. When clicked the Dim following Dim variables have an error:
Dim objRUtils As Redemption.MAPIUtils
Dim colSafeRecips As Redemption.SafeRecipients

(Error Message) - Alert
Compile Error:
User-defined type not defined.

Redemption v3.4 was already installed due to Other Outlook/Exchange programming I have done to automate much of my work.

WinXP(SP1), Office 2003, Exchange 2000

Any suggestions would be greatly appreciated.

Posted by: Nash Dharas | Feb 1, 2005 11:06:19 AM

When I click the "To ..." the debugger loads and highlights the line "Function GetOneName(strDefaultValue As String) As String"

Any ideas to correct this problem?

Posted by: Mick Michel | Feb 4, 2005 3:54:24 PM

I got it installed and working. And was loving it, but the next day it did not work at all on two computers I installed it on. Any ideas on why it would not work after a reboot?

Thank you, I really want to use this add-on, it is just what I need!

Stephanie

Posted by: stephanie | Feb 4, 2005 11:06:07 PM

I found my problem on why it did not work after you reboot. Your security settings under Tools/Macro/security need to be stepped down to Medium where you approve the macro you want to run. Then when you click on the memo icon, it will ask if you approve and it will work from then on.

Hope that helps everyone with the same problem I had.

Posted by: stephanie | Feb 7, 2005 10:26:49 AM

Stephanie,

This is great news. I am glad it is working for you. I hope it helps the others.

Thanks,

Michael

Posted by: Michael Hyatt | Feb 7, 2005 12:33:51 PM

FYI - You must reference the Redemption Library (called SafeOutlook Library - go figure!) in your VB project otherwise you will get the error 'User Defined type not Defined' and/or possibly the stopping of the code on the function line that Nash noted. To reference the dll in your project, open your VB project in outlook (alt-F11) and navigate to Tools....References then scroll down to the SafeOutlook Library and click the box next to it and save your project. That should at least fix those problems. Hope this helps...

Me

Posted by: Me | Feb 9, 2005 10:22:46 AM

WYWO is a wonderful add in. And, very easy to understand. I would like more information on getting the trusted publisher informatiuon implemented. When I start Outlook and click on WYWO I get an enable macro message which doe not contain the obtion to trust the source.

Once again, thank you for such a great tool.

Posted by: Eugene Gearity | Feb 21, 2005 8:09:04 AM

After installing the program when i run the macroand press the TO or CC button i get the following message.
Function GetOneName(strDefaultValue As String) As String

Looking forward for the solution

Posted by: Jagan | Feb 28, 2005 10:39:01 AM

Every time I try to import the frm files my outlook creates and error and restarts, any suggestion

Posted by: you | Mar 31, 2005 7:46:27 AM

I have installed your “While You Were Out” Outlook Addin and I can not seem to get past this error message when clicking on the Send button. What should I do?

Microsoft Visual Basic

Run-time error'429':

ActiveX component can't create object

Continue End Debug Help

The Continue button is not an option. When I hit debug it hilights the folowing line in frmWhileYouWereOut:

Set SafeItem = CreateObject("Redemption.SafeMailItem")

Posted by: Paul | Apr 3, 2005 6:54:17 PM

Sweet App!! I had to follow a few of the "fixes" listed about but it works like a champ. Believe it or not, I work for a software company that still uses those d*mn Pink Pad. Why is it the Cobbler's kids always have no shoes? But hey! No more for me! Thanks!

Posted by: Cary L | Apr 5, 2005 5:20:29 PM

WYWO works will, but on my 17 in screen it is too big for the screen and I can't get to the send button without moving the window off the top of the screen. Any ideas?

Posted by: Richard | Apr 14, 2005 4:55:14 PM

I receive the following error, but the messages go through once I his "End":

Microsoft Visual Basic
Run-time error '13':
Type mismatch

How can I resolve this?

Posted by: Richard | Apr 14, 2005 5:00:35 PM

Just wanted to thank you for this tool, and all the people that gave tips on how to get it to work. I had to follow almost all of the tips, but I like it, and will try and use it for myself, since I don't have an admin, and I sometimes forgot to act on voicemails in a timely manner.

Posted by: Mike | Apr 20, 2005 10:27:50 AM

I receive the following error, but the messages go through once I his "End":

Microsoft Visual Basic
Run-time error '13':
Type mismatch

How can I resolve this?

Also,

Recieved error as below when tying to save changes to settings. Changes seem to take effect though despite the error.

Run Timer Error '380'

Could not set the Value property. Invalid property value

How can I reslove this.

Other than that, I have been looking for this type of tool for years. David Allens hints are great too. I bought the GTD book and download the outlook tips.

Posted by: Phil M | Apr 30, 2005 10:59:44 AM

Just what the doctor ordered... Bravo!

Referenced SafeOutlook library and dropped macro security and it works like a champ.

Thank you.

Posted by: Jim Tall | May 1, 2005 9:45:38 AM

Michael,

I am in exactly the same boat you are in and we created a rather rudimentary version of this ourselves. Thank you for taking the time to put this together.

We are also heavy blackberry users and I wanted to know if this works well with the BB software? Or if there have been any commerical developers who want to take the base code and make it a product they want to add features to and support or if MS has the courage to put it in the Outlook client and reach an entire group of CxO's with a quick and meaningful win.

dws

Posted by: david | May 16, 2005 1:43:09 PM

Post a comment