This Microsoft Visual Basic/Visual Basic for Applications example starts synchronization of the user’s second synchronization profile in response to the user clicking a button on a form. The mySyncObj
variable is declared as a public variable so it can be referenced by other modules.
Public mySyncObj As Outlook.SyncObject
Private Sub Command1_Click()
Dim myOlApp As New Outlook.Application
Dim mySyncs As Outlook.SyncObjects
Set mySyncs = myOlApp.GetNamespace("MAPI").SyncObjects
Set mySyncObj = mySyncs.Item(2)
mySyncObj.Start
End Sub