2010-10-11

Starting Excel 2003 Faster

I start two or three Excel 2003 sessions at the same time so that I can use multiple displays and work on a couple of tasks at a time. To start a new Excel session, you launch it from the Windows Start menu instead of opening an Excel file in Explorer (opening an Excel file loads it in the active Excel session). A new Excel session has, by default, a Task Pane (a panel titled 'Getting Started') and a new workbook, both of which I rarely use, so I close them before opening an existing file.

If you don't want the Task Pane opened by default, open Excel's Options dialog and uncheck View, Show, Startup Task Pane.

If you don't want a new workbook by default, create a new shortcut to start Excel with the /e argument and open Excel with that shortcut.

See Also

2010-09-13

Name Log Files in a Consistent Format

I expect developers to program like I do, which didn't happen this week.

The task is to concatenate log files in a folder into a single file to import into a database. The Windows command to do the job is for /f %a in ('dir /b *.csv') do type %a >> dest.csv. (dir /b lists entries in a folder without any heading.) While testing using echo in place of type, I noticed that due to the way dir sorts file, the script would concatenate log files in this order: Log-02.csv, Log-03.csv, ..., Log.csv i.e. the first log file last. This order seems to correspond with the characters in the ASCII table.

(Aside: Windows Explorer lists Log.csv first because Explorer doesn't use ASCII sort order.)

Of course, just to get the job done, the work-around is to rename Log.csv to Log-01.csv before running the script.

It threw me that developers wouldn't name log files consistently.

2010-09-10

SetLocal EnableDelayedExpansion in CMD Scripts

In a Windows CMD for loop, variables within the loop aren't, by default, resolved into a value for every iteration of the loop. Here's a script that should list all files in a folder.

@echo off
for /f %%a in (*) do (
  set test=%%a
  echo %test%
)

However, when you run the script, only the first file found is output (the variable test is only set in the first iteration of the loop). Turns out that I'm the n'th generation of CMD programmers to trip over this issue. It seems that CMD only processes the for (...) statement once, so the variable test is only set once. To get CMD to reprocess your variable in each iteration, put your code into a setlocal EnableDelayedExpansion ... endlocal block and delimit with exclamation marks any variables that CMD should reprocess in each iteration of the loop (hence the unintuitive name of the block).

@echo off
setlocal EnableDelayedExpansion
for %%a in (*) do (
  set test=%%a
  echo test=!test!
)
endlocal

I couldn't find an official MS documentation of EnableDelayedExpansion or the use exclamation marks for variables.

2010-08-01

Restoring Standard Outlook Forms

If you can't see any of the standard Outlook forms, there are two solutions:

  • Clear your Outlook forms cache:
    1. In Outlook, select menu item Tools, Options.
    2. In Options dialog, select Other tab.
    3. In Other tab, press Advanced Options… button.
    4. In Advanced Options dialog, press Custom Forms… button.
    5. In Custom Forms tab, press Manage Forms… button.
    6. In Forms Manager dialog, press Clear Cache button, then press the Close button.
    7. Close all the Option dialogs and try accessing the form again.
  • If the above doesn't work, a more risky solution is to get Outlook to recreate its cache file:
    1. Exit Outlook.
    2. Use Windows Explorer to open the temporary forms folder. On my WinXP PC, the path is C:\Documents and Settings\<user>\Local Settings\Application Data\Microsoft\FORMS.
    3. Rename or delete the file FRMCACHE.DAT.
    4. Start Outlook again.

See Also