Hi again,

The "permanent" file is the original workbook which you've created, and which normally doesn't store the visitor's details. The "temporary" file is just a saved copy of this "permanent" file in which the current visitor's details have been entered.

The "temporary" file is appended to the email as an attachment, and is then deleted once the email has been sent. In a relatively simple situation such as this you could in fact send the "permanent" file as an attachment, and dispense with the "temporary" file, but the method I posted is one which I used in a more complex situation.

Now - let's try to find out where the problem is occurring!

Go into the VBA Editor, and place the cursor anywhere within the code of the SendEmail function. Now press key F8. You'll see that the first (i.e. Function Declaration) line of the routine is highlighted.

Press the F8 key once again and you'll see that the first executable line (i.e. On Error GoTo ErrorEncountered) of the routine is highlighted. Continue to press the F8 key, and note the line where pressing this key causes the program execution to jump to the "MsgBox "An error was encountered", vbCritical" statement - this is the line which is causing the problem.

When you've identified the "problem line", have a look at its code and see if there's anything obviously wrong with it - e.g. a reference to a non-existent filepath etc. If you can identify and solve the problem yourself, that's great - otherwise let me know which line is involved and I'll see what I can do.

Regards,

Greg M