SELF Solved: outlook sync from excel

cdkeito

Board Regular
Joined
Aug 26, 2005
Messages
95
hi all,

a litle question:

how do you make outlook to start posting yours email after the well know .send or .display (sendkeys "%s")?
I presume something like this:

Code:
Dim colSyncObjects As Outlook.SyncObjects
Dim objSyncObject As Outlook.SyncObject

Sub StartSync()
   Set colSyncObjects = Session.SyncObjects
   Set objSyncObject = colSyncObjects("All Folders")
   objSyncObject.Start
End Sub

I start with outlook closed (only excel).
(If i's not clear, I'm interested in the START metod)
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I think that is outlook only code, so i need only a port to excel code.

like (I think):
Code:
Sub sync_sync()
Dim OLSyncs As Outlook.SyncObjects
Dim OLSync As Outlook.SyncObject 
Set OLApp = CreateObject("Outlook.Application")
Set OLMAPI = OLApp.Getnamespace("mapi")
Set OLSyncs = OLMAPI.SyncObjects
Set OLSync=OLSyncs.Item("All Accounts")
OLSync.start
Set OLSync = nothing 
Set OLSyncs = nothing
Set OLMAPI = nothing
Set OLApp = nothing
End Sub
 
Upvote 0
Hi there,

Are you looking to Sync your items or automatically send an email from Excel without having to click the Send button?
 
Upvote 0
I'm looking in the outlook's "start" metod to begin to send those email builded with excel (see 1st post), overwise they stay in the closed outlook (even if you make a send).

so: I'm looking to Sync my items.

Now, after running my macro, i'll have to open outlook and start manualy (or wait for the auto one) the send/receive porcess.

I can use a keysend on outlook, but it has its on functions.
 
Upvote 0
If you are running routine(s) from within Excel that create Outlook mail messages and you want to directly send them, post the code you are using and the steps taken with it thus far.
 
Upvote 0
Its very very long, but i can post the fuction to manage mail:
Code:
Function Mail_Outlook(ind As String)
    Dim OutApp As Outlook.Application
    Dim OutMail As Outlook.MailItem
    Dim strdate As String
    strdate = "Elaborati"
    DefPath = ThisWorkbook.path
    If Right(DefPath, 1) <> "\" Then
        DefPath = DefPath & "\"
    End If
    FileNameZip = DefPath & strdate & ".zip"
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(olMailItem)
        With OutMail
            .To = "" & ind & ""
            .CC = ""
            .BCC = ""
            .Subject = "CLIENTI ATTIVI"
            .Body = "regalo"
            .Attachments.Add FileNameZip
            .Display
            Application.Wait (Now + TimeValue("0:00:02"))
            Application.SendKeys "%a"  ' send
            Application.Wait (Now + TimeValue("0:00:02"))
        End With
        Kill FileNameZip
    Set OutMail = Nothing
    Set OutApp = Nothing
End Function
In the main routine I want to add a :
"and you want to directly send them"
so I's looking for the start metod above.

At very last resort I can use something like:
Code:
Dim OutApp As Outlook.Application
Set OutApp = CreateObject("Outlook.Application")
OutApp.visible = True
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%r" ' send & receive
Application.Wait (Now + TimeValue("0:00:02"))
Set OutApp = Nothing
when I can, I'll some of those codes.
 
Upvote 0

Forum statistics

Threads
1,214,837
Messages
6,121,883
Members
449,057
Latest member
Moo4247

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top