Mailboxes rename macro stopped working

mikolajek

Member
OS Version(s)
  1. Windows
Outlook version
Outlook 365 64 bit
Email Account
Office 365 Exchange
Operating system::    Win11 Pro 25H2
Outlook version:     2510 build 19328.201
Email type or host:    Microsoft 365

I've been running the below macro for years already with my Outlook 365. It always worked as a charm.
After the latest Office update, it won't work anymore - it just randomly stops at different lines (mostly at the one marked in yellow).
Can someone review it and help me understand the possible reason?

Public Sub ChangeMailboxName()
Dim colStores As Outlook.Stores
Dim oStore As Outlook.Store
Dim oRoot As Outlook.Folder

Dim arrOldName As Variant
Dim arrNewName As Variant

' Set up the array
arrOldName = Array("email1", "email2")
arrNewName = Array("mailbox1", "mailbox2")

' Go through the array and look for a match, then do something
For i = LBound(arrOldName) To UBound(arrOldName)

Set colStores = Application.session.Stores
For Each oStore In colStores
Set oRoot = oStore.GetRootFolder
Debug.Print (oRoot)

If oRoot = arrOldName(i) Then
oRoot.Description = oRoot.Name
oRoot.Name = arrNewName(i)
End If

Next
'On Error Resume Next


Next i

Set oRoot = Nothing
Set oStore = Nothing
Set colStores = Nothing
End Sub
 
Similar threads
Thread starter Title Forum Replies Date
U Moving Microsoft 365 mailboxes from a different domain to our current domain Exchange Server Administration 2
J unable to get my new install of Outlook to display mailboxes in the single-line format. Using Outlook 1
P Move emails between 2 mailboxes. Using Outlook 0
J Outlook 2016 After a search in all mailboxes, where is each message that was found? Using Outlook 6
S newly added shared mailboxes downloading 500GB data a day Exchange Server Administration 1
S auto-mapping mailboxes in outlook impacting an ost file? Exchange Server Administration 2
J Accessing calendar items for Resource Mailboxes Outlook VBA and Custom Forms 2
S How to extract mail items from multiple folders and shared mailboxes? Outlook VBA and Custom Forms 0
D Multiple mailboxes, 1 certificate. How to prevent message "Invalid Certificate" Using Outlook 0
Diane Poremsky Shared Mailboxes and the Default 'Send From' Account Using Outlook 0
Rupert Dragwater Some mailboxes show deleted items as not read Using Outlook 5
J Outlook 2010 and 2013 'team' calendar shows AD accounts without mailboxes Using Outlook 5
Diane Poremsky Open Shared Mailboxes in Outlook on the Web Using Outlook 0
L Room mailboxes and delegates Exchange Server Administration 1
Diane Poremsky Shared Mailboxes and the Deleted Items Folder Using Outlook 0
Diane Poremsky Shared Mailboxes and the Default 'Send From' Account Using Outlook 0
J Multiple mailboxes / multiple contacts Using Outlook 1
JohnP Shared Mailboxes "Save Sent Item" Using Outlook 2
M VBA Auto-Reply code for Two Mailboxes on one Outlook Session. Outlook VBA and Custom Forms 4
N Outlook user with 13 shared mailboxes open in profile Using Outlook 1
C Outlook 2010, two exchange mailboxes configured.Unable to see 2ndrymeeting req Using Outlook 2
skylark53 Any way of search multiple mailboxes in Outlook 2013? Using Outlook 0
K Outlook 2010, multiple shared mailboxes, reminder nightmare Using Outlook 4
N Exchange mailboxes Exchange Server Administration 2
S Outlook 2010/Exchange 2010 Multi Mailboxes (Server unavailable) Using Outlook 6
J Multiple mailboxes in OL 2010 Using Outlook 1
U Cached mode additional mailboxes Using Outlook 2
F Hide calendars from shared mailboxes Using Outlook 2
D Extracting Location info from All Day Event in mailboxes into webpage Exchange Server Administration 3
D Shared mailboxes Exchange Server Administration 1
D Report on mailboxes which have exceeded quota? Exchange Server Administration 1
T Multiple Exchange Mailboxes Using Outlook 3
J meeting room mailboxes Using Outlook 1
J 2010 duplicate mailboxes, exchange online vs app data folder. Using Outlook 2
T multiple mailboxes BCM (Business Contact Manager) 1
J GBetting a list of shared mailboxes Outlook VBA and Custom Forms 1
S Unable to enumerate Mailboxes in NON Cached Mode (if more than 2) Outlook VBA and Custom Forms 8
O using VSTO to get Available Mailboxes Outlook VBA and Custom Forms 11
P Yahoo/IMAP folder rename by Outlook desktop 365 Using Outlook 0
M Outlook 365 Rename Outlook Priority Using Outlook 3
G Save and Rename Outlook Email Attachments Outlook VBA and Custom Forms 0
C How to rename subject line and forward the email Outlook VBA and Custom Forms 2
W Save and rename outlook email attachments to include domain name & date received Outlook VBA and Custom Forms 4
W Save Outlook attachment in network folder and rename to current date and time Outlook VBA and Custom Forms 18
D Autosave Attachment and Rename Outlook VBA and Custom Forms 1
F Rename Contacts Greyed Out Using Outlook 0
N Rename Subject Line with Email Content Outlook VBA and Custom Forms 3
K IMAP Server Wants to alert you to the following: cannpt rename system folder Using Outlook 1
Diane Poremsky Rename Email Accounts and Data Files in the Folder List Using Outlook 0
S VBA code to rename a task (flagged message) Outlook VBA and Custom Forms 1

Similar threads

Back
Top