Question: I'm looking for VBA code for Outlook 2013 that will automatically save a draft either when opening the composition window, when replying or forwarding an email (it's OK if it fires on newly-composed messages also) or just before sending it when hitting the Send button.

Essentially emulating hitting the "Save" icon or Ctrl-S either before composing or before the message gets sent.

Outlook generates a "Could not complete the operation because the mail provider does not support it" error when replying to or forwarding a non-Google Apps account email when Google Apps accounts are combined with other email accounts in Outlook.

I discovered that a work-around is to manually save the email before sending it. I can do that manually but often forget. Can't do it after the error message appears. Trying to save after the "could not complete" error is thrown results in another error.

BTW, I already have a routine running off the Application\_ItemSend event; will adding another conflict?

Update: Here is a version of what I tried:

```
Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)
' Runs when the item is being sent.
    Call AutoSaveDraft(item)
    Call CheckSubject(item)
End Sub

```

(CheckSubject fires)

```
Private Sub AutoSaveDraft(item As Object)
    item.Save
    SendKeys "+{F12}" ' Save the message. ##
    SendKeys "^S"
    Sleep 1000 ' Pause execution 1 second. The Windows sleep function is      called in the beginning ##
End Sub

```

(Yes, I have all three potential save methods. Have also tried them individually.

Answer: 
Expand the **Databases** branch to show all the DBs on the system..

Then either

* Right click on the DB and select **Run SQL Scripts**

or

* Expand the DB to show schemas
* Right click your selected schema and select **New-->Function-->SQL**

The first is probably your best option as you seem to have the complete source.
Enter it in the STRSQL window as a whole .. for example (the INSTRB UDF below)

```
CREATE FUNCTION INSTRB (C1 VarChar(4000), C2 VarChar(4000), N integer, M integer)
 RETURNS Integer
 SPECIFIC INSTRBOracleBase
 LANGUAGE SQL
 CONTAINS SQL
 NO EXTERNAL ACTION
 DETERMINISTIC
BEGIN ATOMIC
DECLARE Pos, R, C2L Integer;

SET C2L = LENGTH(C2);

IF N > 0 THEN
   SET (Pos, R) = (N, 0);
   WHILE R < M AND Pos > 0 DO
      SET Pos = LOCATE(C2,C1,Pos);
         IF Pos > 0 THEN
         SET (Pos, R) = (Pos + 1, R + 1);
      END IF;
   END WHILE;

   RETURN (Pos - 1)*(1-SIGN(M-R));
ELSE
   SET (Pos, R) = (LENGTH(C1)+N, 0);
   WHILE R < M AND Pos > 0 DO
      IF SUBSTR(C1,Pos,C2L) = C2 THEN
         SET R = R + 1;
      END IF;
      SET Pos = Pos - 1;
   END WHILE;

   RETURN (Pos + 1)*(1-SIGN(M-R));
END IF;

END!

```

It should output `Function INSTRB was created in QGPL.`

It is reusable