如何在启动Outlook时自动打开多个Outlook窗口?
当您启动Outlook账号时,邮件窗口会正常打开。是否可以在启动Outlook的同时自动打开其他Outlook窗口,例如邮件、日历、联系人和任务窗口?
使用VBA代码在启动Outlook时自动打开多个Outlook窗口
使用VBA代码在启动Outlook时自动打开多个Outlook窗口
在这里,我可以介绍一个VBA代码,帮助您在启动Outlook时立即打开多个Outlook窗口,例如邮件、日历、联系人和任务窗口。请按照以下步骤操作:
1. 按住 ALT + F11 键打开 Microsoft Visual Basic for Applications 窗口。
2. 在 Microsoft Visual Basic for Applications 窗口中,双击 Project1(VbaProject.OTM) 窗格中的 ThisOutlookSession 以打开模块,然后将以下代码复制并粘贴到空白模块中。
VBA代码:在启动Outlook时自动打开多个Outlook窗口:
Private Sub Application_Startup()
Dim xCalendar As Folder
Dim xTasks As Folder
Dim xContacts As Folder
Dim xInbox As Folder
Dim xExplorer As Outlook.Explorer
Dim xWidth, xHeight As Integer
On Error Resume Next
xWidth = Int(GetSystemMetrics32(0) / 4) + 60
xHeight = GetSystemMetrics32(1)
Set xInbox = Outlook.Application.ActiveExplorer.CurrentFolder
xInbox.Display
Set Application.ActiveExplorer.CurrentFolder = xInbox
Set xExplorer = Application.ActiveExplorer
With xExplorer
.WindowState = olNormalWindow
.Top = 0
.Left = 0
.Height = xHeight
.Width = xWidth
End With
Set xCalendar = Outlook.Session.GetDefaultFolder(olFolderCalendar)
xCalendar.Display
Set xExplorer = Application.ActiveExplorer
With xExplorer
.WindowState = olNormalWindow
.Top = 0
.Left = xWidth
.Height = xHeight
.Width = xWidth
End With
Set xContacts = Outlook.Session.GetDefaultFolder(olFolderContacts)
xContacts.Display
Set xExplorer = Application.ActiveExplorer
With xExplorer
.WindowState = olNormalWindow
.Top = 0
.Left = xWidth * 2
.Height = xHeight
.Width = xWidth
End With
Set xTasks = Outlook.Session.GetDefaultFolder(olFolderTasks)
xTasks.Display
Set xExplorer = Application.ActiveExplorer
With xExplorer
.WindowState = olNormalWindow
.Top = 0
.Left = xWidth * 3
.Height = xHeight
.Width = xWidth
End With
End Sub

3. 接着继续点击 插入 > 模块,将下面的代码复制并粘贴到打开的空白模块中,参见截图:
Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" (ByVal xIndex As Long) As Long

4. 然后保存并关闭代码,重新启动Outlook以使代码生效。现在,当打开Outlook时,邮件、日历、联系人和任务窗口将会自动并排打开,参见截图:

最佳 Office 办公效率工具
重磅消息:Kutools for Outlook 推出免费版本!
体验全新 Kutools for Outlook 免费版,70 多个强大功能,永久免费使用!点击立即下载!
🤖 Kutools AI :利用先进的AI技术轻松处理邮件,包括答复、总结、优化、扩展、翻译和撰写邮件。
📧 邮件自动化:自动答复(支持POP和IMAP) /计划发送邮件 /发送邮件时根据规则自动抄送密送 / 自动转发(高级规则) / 自动添加问候语 / 自动将群发邮件拆分为单独邮件 ...
📨 邮件管理:撤回邮件 / 按主题等方式阻止诈骗邮件 / 删除重复邮件 / 高级搜索 / 整合文件夹 ...
📁 附件专家:批量保存 / 批量拆离 / 批量压缩 / 自动保存 / 自动拆离 / 自动压缩 ...
🌟 界面魔法:😊更多精美个性表情 /重要邮件来临时提醒您 / 最小化而非关闭 Outlook ...
👍 一键高效操作:带附件全部答复 /反钓鱼邮件 / 🕘显示发件人时区 ...
👩🏼🤝👩🏻 联系人与日历:从选中的邮件批量添加联系人 / 将联系人组拆分为多个独立组 / 移除生日提醒 ...
使用 Kutools,支持英语、西班牙语、德语、法语、中文及40 多种其他语言,满足您的语言偏好!
一键解锁 Kutools for Outlook。无需等待,立即下载,提升办公效率!

