Bỏ qua nội dung chính

Làm cách nào để tự động mở nhiều cửa sổ outlook khi Outlook khởi động? 

Khi bạn khởi chạy tài khoản Outlook, cửa sổ Thư được mở như bình thường. Có thể tự động mở các cửa sổ Outlook khác, chẳng hạn như cửa sổ Thư, Lịch, Danh sách Liên hệ và Công việc cùng một lúc khi Outlook khởi động không?

Tự động mở nhiều cửa sổ outlook khi Outlook khởi động bằng mã VBA


Tự động mở nhiều cửa sổ outlook khi Outlook khởi động bằng mã VBA

Ở đây, tôi có thể giới thiệu mã VBA để giúp bạn mở nhiều cửa sổ Outlook, chẳng hạn như cửa sổ Thư, Lịch, Danh bạ và Công việc ngay lập tức khi khởi chạy Outlook. Vui lòng làm như sau:

1. Giữ phím tắt ALT + F11 phím để mở Microsoft Visual Basic cho các ứng dụng cửa sổ.

2. Trong Microsoft Visual Basic cho các ứng dụng cửa sổ, nhấp đúp ĐâyOutlookSession từ Project1 (VbaProject.OTM) để mở mô-đun, sau đó sao chép và dán mã sau vào mô-đun trống.

Mã VBA: Tự động mở nhiều cửa sổ outlook khi Outlook khởi động:

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

doc mở nhiều cửa sổ khởi động 1

3. Sau đó, nhấp vào Chèn > Mô-đun, sao chép và dán mã bên dưới vào mô-đun trống đã mở, xem ảnh chụp màn hình:

Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" (ByVal xIndex As Long) As Long

doc mở nhiều cửa sổ khởi động 2

4. Sau đó, lưu và đóng mã, khởi động lại Outlook để mã có hiệu lực. Bây giờ, khi mở Outlook, các cửa sổ Thư, Lịch, Danh bạ và Công việc sẽ được mở tự động song song với nhau, hãy xem ảnh chụp màn hình:

doc mở nhiều cửa sổ khởi động 3


Công cụ năng suất văn phòng tốt nhất

Kutools cho Outlook - Hơn 100 tính năng mạnh mẽ để tăng cường Outlook của bạn

🤖 Trợ lý thư AI: Email chuyên nghiệp tức thì với phép thuật AI--một cú nhấp chuột để có câu trả lời xuất sắc, giọng điệu hoàn hảo, khả năng thông thạo đa ngôn ngữ. Chuyển đổi email một cách dễ dàng! ...

📧 Tự động hoá email: Vắng Mặt (Có sẵn cho POP và IMAP)  /  Lên lịch gửi email  /  Tự động CC/BCC theo quy định khi gửi Email  /  Tự động chuyển tiếp (Quy tắc nâng cao)   /  Tự động thêm lời chào   /  Tự động chia email nhiều người nhận thành các tin nhắn riêng lẻ hữu ích. Cảm ơn !

📨 Quản lý email: Dễ dàng thu hồi email  /  Chặn email lừa đảo theo chủ đề và những người khác  /  Xóa các email trùng lặp  /  Tìm Kiếm Nâng Cao  /  Hợp nhất các thư mục hữu ích. Cảm ơn !

📁 Tệp đính kèm chuyên nghiệpLưu hàng loạt  /  Tách hàng loạt  /  Nén hàng loạt  /  Tự động lưu   /  Tự động tách  /  Tự động nén hữu ích. Cảm ơn !

🌟 Giao diện ma thuật: 😊Thêm nhiều biểu tượng cảm xúc đẹp và thú vị hơn   /  Tăng năng suất Outlook của bạn với chế độ xem theo thẻ  /  Thu nhỏ Outlook thay vì đóng hữu ích. Cảm ơn !

👍 Kỳ quan chỉ bằng một cú nhấp chuột: Trả lời tất cả bằng tệp đính kèm đến  /   Email chống lừa đảo  /  🕘Hiển thị múi giờ của người gửi hữu ích. Cảm ơn !

👩🏼‍🤝‍👩🏻 Danh bạ & Lịch: Thêm hàng loạt liên hệ từ các email đã chọn  /  Chia nhóm liên hệ thành các nhóm riêng lẻ  /  Xóa lời nhắc sinh nhật hữu ích. Cảm ơn !

Trên 100 tính năng Chờ đợi sự khám phá của bạn! Bấm vào đây để khám phá thêm.

 

 

Comments (6)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hola me sale este error, que hago?
This comment was minimized by the moderator on the site
El codigo de este proyecto se debe actualizar para usarse en sistemas de 64 bits. Revise y actualice las instrucciones Declare y, a continuación, márquelas con el atributo PtrSafe
This comment was minimized by the moderator on the site
ya pude solucionar el tema de PtrSafe, ahora me marca que no se ha definido Sub o Function; señalando en amarillo Private Sub Application_Startup() y señalando en azul GetSystemMetrics32, ahora si no me deja correr la macro, que hago?
This comment was minimized by the moderator on the site
Ya pude resolver el tema de arriba, ahora solo quiero las ventanas de inbox y task se abran de la siguinete manera (eliminando del codigo las ventanas calendario y contactos).


Task en mi pantalla secundaria (me gustaría saber como definir la posición de la pantalla que lo quiero y los pixeles) y el inbox en pantalla completa en mi monitor principal, me pueden ayudar?

Saludos!
This comment was minimized by the moderator on the site
Is there a way to make this open the windows in separate screens? I have 3 screens at my work, and I want to have my inbox open on screen 3, calendar to open on screen 2, and the tasks to open on screen 1, all maximised. Not fussed about the contacts page. Any advice on how to alter that would be appreciated. Currently they all open on the one screen, inbox maximised and calendar/tasks in smaller windows.
This comment was minimized by the moderator on the site
Hello, Chris,
May be the following VBA code can help you to solve your problem. Please try it.

Private Declare PtrSafe Function GetSystemMetrics32 Lib "User32" Alias "GetSystemMetrics" (ByVal xIndex As Long) As Long
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 As Integer, xHeight As Integer
On Error Resume Next
xWidth = GetSystemMetrics32(0)
xHeight = GetSystemMetrics32(1)
Set xInbox = Outlook.Application.Session.GetDefaultFolder(olFolderInbox)
Set Outlook.Application.ActiveExplorer.CurrentFolder = xInbox
Set xExplorer = Application.ActiveExplorer
ExplorerDisplay xExplorer, 0
Set xCalendar = Outlook.Session.GetDefaultFolder(olFolderCalendar)
xCalendar.Display
Set xExplorer = Application.ActiveExplorer
ExplorerDisplay xExplorer, xWidth
Set xTasks = Outlook.Session.GetDefaultFolder(olFolderTasks)
xTasks.Display
Set xExplorer = Application.ActiveExplorer
ExplorerDisplay xExplorer, (xExplorer.Width + 1) * -1
End Sub

Sub ExplorerDisplay(Exp As Explorer, ByVal L As Integer)
With Exp
.WindowState = olNormalWindow
.Top = 0
.Left = L
.WindowState = olMaximized
End With
End Sub
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations