推荐:将OL“收件箱”加入IE收藏夹的代码
Sub FaveChange()
Dim appolApp As Outlook.Application
Dim nmsName As Outlook.NameSpace
Dim fldFolder As Outlook.MAPIFolder
Dim strName As String
Set appolApp = New Outlook.Application
'Create instance of namespace
Set nmsName = appolApp.GetNamespace("MAPI")
Set fldFolder = nmsName.GetDefaultFolder(olFolderInbox)
'Prompt user for a Favorites list name
strName = _
InputBox("Type the name of the folder as it will appear in the Favorites list.")
Call FaveList(fldFolder, strName)
End Sub
Sub FaveList(ByRef fldFolder As MAPIFolder, ByVal strName As String)
'Add a Folder object to the Favorites list in Internet Explorer
'Call method with strName as name argument
fldFolder.AddToFavorites fNoUI:=True, Name:=strName
'Display a message to the user
MsgBox "The folder " & fldFolder.Name & _
" was added to the Internet Explorer Favorites list as " & strName & "."
End Sub |