PDA

View Full Version : Outlook VBA Synching Problem



Aldz
11-09-2011, 12:22 AM
Good day to everyone. My boss in the office uses 2 email accounts in his pc (1 exchange server w/o OWA and 1 gmail). He asked me to make it so that he would be able to send emails using gmail to internal email in our exchange server when he's abroad. I found vba to be the answer but i'm currently stuck with a synching problem.

The way I set it up is I send a mail using gmail to internal emails BUT I have it send a BCC to myself. that way when outlook gets the email my vba script kicks in and resends everything as it is to our internal emails using the other exchange account in his outlook. This works wonderfully well but I am always stuck in (Saving Synchronization log) everytime I start to get the email and the only way I can get it is if I close outlook and open it again. Each time I send an email i'll have to reopen outlook and that would be troublesome especially for my boss. Here's the code I have used:

Sub MyRule(Item As Outlook.MailItem)

Dim olkMsg As Outlook.MailItem

Set olkMsg = Item.ReplyAll
With olkMsg
.SendUsingAccount = Application.Session.Accounts(1)
.To = Item.To
.Subject = Item.Subject
.Display
.Send
End With
Set olkMsg = Nothing

End Sub

Any input is welcome. Thank you in advance guys