ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 2578|回复: 0

斑竹:请稍作讲解

[复制链接]

TA的精华主题

TA的得分主题

发表于 2004-7-28 17:19 | 显示全部楼层 |阅读模式
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助

Sub ToggleDays() Dim objOL As Outlook.Application Dim objExpl As Outlook.Explorer Dim objCBB As Office.CommandBarButton Const cbbOneDayID = 1094 Const cbbFiveDaysID = 5556 On Error Resume Next

Set objOL = CreateObject("Outlook.Application") Set objExpl = objOL.ActiveExplorer If objExpl.CurrentFolder.DefaultItemType = olAppointmentItem Then Set objCBB = objExpl.CommandBars.FindControl(, cbbOneDayID) If objCBB.State = msoButtonDown Then Set objCBB = objExpl.CommandBars.FindControl(, cbbFiveDaysID) objCBB.Execute Else objCBB.Execute End If End If Set objOL = Nothing Set objExpl = Nothing Set objCBB = Nothing End Sub

'--------------------------------------------------------------------------------------------

Sub GoToFindContacts() Dim objOL As Outlook.Application Dim objNS As Outlook.NameSpace Dim objContacts As Outlook.MAPIFolder Dim objExpl As Outlook.Explorer Dim colCB As Office.CommandBars Dim objFindCBB As Office.CommandBarButton Set objOL = CreateObject("Outlook.Application") Set objNS = objOL.GetNamespace("MAPI") ' display contacts as active folder Set objExpl = objOL.ActiveExplorer Set objContacts = objNS.GetDefaultFolder(olFolderContacts) Set objExpl.CurrentFolder = objContacts ' get Find button, check its state and execute if not already active Set colCB = objExpl.CommandBars Set objFindCBB = colCB.FindControl(, 5592) With objFindCBB If .State = msoButtonUp Then .Execute End If End With Set objOL = Nothing Set objNS = Nothing Set objContacts = Nothing Set colCB = Nothing Set objFindCB = Nothing Set objExpl = Nothing End Sub

'-------------------------------------------------------------------------------------

' use this procedure to test the routine ' substitute the name of whatever stationery you want to use Sub LaunchNotebookMessage() Dim strStatName As String strStatName = "Notebook" Call CreateStationeryMessage(strStatName) End Sub

Sub CreateStationeryMessage(strName As String) Dim objCB As Object Dim objCBB As Object ' Office.CommandBarButton Set objCB = Application.ActiveExplorer.CommandBars.FindControl(, 31146) If Not objCB Is Nothing Then ' Set objCBStat = objCB.Controls.Item(strName) ' didn't work For Each objCBB In objCB.Controls If objCBB.Caption = strName Then objCBB.Execute Exit For End If Next End If Set objCB = Nothing Set objCBB = Nothing End Sub

'-------------------------------------------------------------------------------------

Public Sub SendNow() Dim oApp As Outlook.Application Dim oCtl As Office.CommandBarControl Dim oPop As Office.CommandBarPopup Dim oCB As Office.CommandBar Dim oNS As Outlook.NameSpace Dim oItem As Object

'First find and send the current item to the Outbox Set oApp = CreateObject("Outlook.Application") Set oNS = oApp.GetNamespace("MAPI") Set oItem = oApp.ActiveInspector.CurrentItem On Error Resume Next oItem.Send

If Err = 0 Then 'Then use the Send action in the Tools menu 'to send the item from the Outbox Set octl = oApp.ActiveExplorer.CommandBars.FindControl(ID:=5488) octl.Execute End If

Set oApp = Nothing Set oCtl = Nothing Set oPop = Nothing Set oCB = Nothing Set oNS = Nothing Set oItem = Nothing End Sub

'-------------------------------------------------------------------------------------

Sub CopyToMRU() Dim objOL As Outlook.Application Dim objExpl As Outlook.Explorer Dim objSel As Outlook.Selection Dim colCB As Office.CommandBars Dim objCBB As Object Dim objItem As Object Dim objCopy As Object Set objOL = Application ' CreateObject("Outlook.Application") Set objExpl = objOL.ActiveExplorer Set objSel = objExpl.Selection Select Case objSel.Count Case 0 ' nothing selected; do nothing Case Is <= 10 For Each objItem In objSel Set objCopy = objItem.Copy objCopy.Save Next Set colCB = objExpl.CommandBars Set objCBB = colCB.FindControl(, 2778) If Not objCBB Is Nothing Then objCBB.Execute End If Case Is > 10 ' too many items End Select Set objCopy = Nothing Set objItem = Nothing Set objCBB = Nothing Set colCB = Nothing Set objSel = Nothing Set objExpl = Nothing Set objOL = Nothing End Sub

'------------------------------------------------------------------------------------

Sub ShowURL(strURL As String) Dim objExpl As Outlook.Explorer Dim colCB As Office.CommandBars Dim objCBB As Office.CommandBarComboBox On Error Resume Next Set objExpl = Application.ActiveExplorer Set colCB = objExpl.CommandBars Set objCBB = colCB.FindControl(, 1740) If Not objCBB Is Nothing Then objCBB.Text = strURL objCBB.Execute End If Set objCBB = Nothing Set colCB = Nothing Set objExpl = Nothing End Sub

[此贴子已经被作者于2004-7-28 17:26:35编辑过]
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-12-23 00:19 , Processed in 0.033122 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表