Article ID: 184791
Article Last Modified on 2/28/2004
182158 OL98: (CW) What Are Offline Folders and How Do You Use Them?
Sub SynchronizeOutlookFolders()
Dim outapp As Outlook.Application
Dim olns As Outlook.NameSpace
Dim MyInbox As Outlook.MAPIFolder
Dim MyExplorer As Outlook.Explorer
Dim MyMenu As CommandBar
Dim MyCmd As CommandBarControl
Set outapp = New Outlook.Application
Set olns = outapp.GetNamespace("MAPI")
Set MyInbox = olns.GetDefaultFolder(olFolderInbox)
Set MyExplorer = MyInbox.GetExplorer
' Reference the Tools menu
Set MyMenu = MyExplorer.CommandBars.Item("Tools")
' Reference the Synchronize All Folders command
Set MyCmd = MyMenu.Controls("Synchronize").Controls("All Folders")
' Execute the Synchronize All Folders command
MyCmd.Execute
MyExplorer.Close
End Sub
Sub CommandButton1_Click()
Set MyExplorer = Application.ActiveExplorer
Set MyMenu = MyExplorer.CommandBars.Item("Tools")
Set MyCmd = MyMenu.Controls("Synchronize").Controls("All Folders")
MyCmd.Execute
End Sub
182394 OL98: How to Use Command Bars in Outlook Solutions
180826 OL98: Resources for Custom Forms and Programming
182349OL98: Questions About Custom Forms and Outlook Solutions
Outlook Synchronize Folders
Additional query words: OutSol OutSol98
Keywords: kbhowto kbprogramming KB184791