Problem running a UserForm from an Autoexec macro

Article contributed by Dave Rado

If the Autoexec macro Shows a userform and the user opens Word by launching a Word document (e.g. by double-clicking on a Word document in Windows Explorer), they will get an error message saying: Cannot find file [path & filename of the file the user double-clicked on] (or one of its components).  Make sure the path and filename are correct and that all required libraries are available.

The bug is very easy to reproduce.  Create a user form called (e.g.) TempFm - it doesn't even need to have any code behind it or any controls in order to reproduce the bug.

Then create an Autoexec macro in the Normal template as follows:

Public Sub AutoExec()
End Sub

To get round the bug use Application.OnTime, as in:

Public Sub AutoExec()  
    Application.OnTime _
            When:=Now + TimeValue("00:00:02"), _
End Sub

Public Sub ShowForm()
End Sub