Skip to main content

Conas gach fillteán a leathnú go huathoibríoch agus Outlook á thosú?

De ghnáth, nuair a leathnaíonn tú nó nuair a chlaonann tú fillteán i bPána Nascleanúna Outlook agus nuair a dhúnann tú an clár ina dhiaidh sin, coinníonn an fillteán a staid leathnaithe nó tite nuair a athosclaíonn sé Outlook. Mar sin féin, cad má theastaíonn uait go leathnófar gach fillteán go huathoibríoch gach uair a thosaíonn tú Outlook? Soláthraíonn an t-alt seo réiteach VBA chun é sin a bhaint amach.

Leathnaigh gach fillteán go huathoibríoch nuair a thosaíonn Outlook ag baint úsáide as VBA

Cluaisín Oifige - Cumasaigh Eagarthóireacht agus Brabhsáil Tábáilte i Microsoft Office, Ag Cur le hObair
Kutools le haghaidh Outlook - Treisiú Outlook le 100+ Gnéithe Casta le haghaidh Éifeachtúlacht Superior
Treisigh do Outlook 2021 - 2010 nó Outlook 365 leis na hardghnéithe seo. Bain sult as triail chuimsitheach 60-lá saor in aisce agus ardaigh do thaithí ríomhphoist!

mboilgeog cheart gorm saighead Leathnaigh gach fillteán go huathoibríoch nuair a thosaíonn Outlook ag baint úsáide as VBA

Léireoidh an treoir seo conas script VBA a úsáid chun gach fillteán sa Phána Nascleanúna a leathnú go huathoibríoch gach uair a sheolann tú Outlook. Lean na céimeanna seo chun an script VBA a chur i bhfeidhm:

  1. Preas Alt + F11 eochracha ag an am céanna chun an Microsoft Visual Basic d’Fheidhmchláir fhuinneog.
  2. Leathnaigh an tionscadal 1 agus Microsoft Outlook Object sa tionscadal pane, cliceáil faoi dhó chun an ThisOutlookSession fhuinneog, agus ansin greamaigh an cód VBA thíos isteach ann.

    VBA: Leathnaigh go huathoibríoch gach fillteán in Outlook

    Public WithEvents GEx As Explorer
    Public GFlag As Boolean
    Private Sub Application_Startup()
      'Update by ExtendOffice 2023/12/08
      Set GEx = Application.ActiveExplorer
      GFlag = False
    End Sub
    
    Private Sub GEx_SelectionChange()
      If GFlag = False Then
        ExpandAllFolders
      End If
      GFlag = True
    End Sub
    
    Public Sub ExpandAllFolders()
      Dim xNameSpace As Outlook.NameSpace
      Dim xFlds As Outlook.Folders
      Dim xCurrFld As Outlook.MAPIFolder
      Dim xFld As Outlook.MAPIFolder
      Dim xExpandDefaultStoreOnly As Boolean
      Dim xModule As NavigationModule
      On Error Resume Next
      xExpandDefaultStoreOnly = False
      Set xNameSpace = Application.Session
      Set xModule = Application.ActiveExplorer.NavigationPane.CurrentModule
      Set xCurrFld = Application.ActiveExplorer.CurrentFolder
      If xExpandDefaultStoreOnly = True Then
        Set xFld = xNameSpace.GetDefaultFolder(olFolderInbox)
        Set xFld = xFld.Parent
        Set xFlds = xFld.Folders
        LoopFolders xFlds, True
      Else
        LoopFolders xNameSpace.Folders, True
        LoopFolders xNameSpace.Folders, False
      End If
      DoEvents
      Set Application.ActiveExplorer.NavigationPane.CurrentModule = xModule
      Set Application.ActiveExplorer.CurrentFolder = xCurrFld
      Set xNameSpace = Nothing
      Set xModule = Nothing
      Set xCurrFld = Nothing
    End Sub
    
    Private Sub LoopFolders(Flds As Outlook.Folders, ByVal All As Boolean)
      Dim xFld As Outlook.MAPIFolder
      On Error Resume Next
      For Each xFld In Flds
        Select Case All
          Case True
            If xFld.DefaultItemType = olMailItem Then
              Set Application.ActiveExplorer.CurrentFolder = xFld
              DoEvents
              If xFld.Folders.Count > 0 Then
                LoopFolders xFld.Folders, All
              End If
            End If
          Case False
            Set Application.ActiveExplorer.CurrentFolder = xFld
            DoEvents
            If xFld.Folders.Count > 0 Then
              LoopFolders xFld.Folders, All
            End If
        End Select
      Next
    End Sub
  3. Sábháil an cód agus dún an Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

As seo amach, nuair a atosófar Outlook, leathnófar gach fillteán go huathoibríoch in Outlook.

Nótaí:

  • Ní féidir leis an VBA seo na fillteáin chuardaigh tite a oscailt agus Outlook á atosú.
  • Chun a chinntiú go bhfeidhmíonn an script VBA i gceart, tá sé riachtanach do shocruithe macra a choigeartú in Outlook. Téigh go dtí Comhad > Roghanna > Ionad Iontaobhas > Socruithe Ionad Iontaobhais > Socruithe Macra, agus roghnaigh an Cumasaigh gach macra rogha. Ligeann an socrú seo don script VBA rith gan srianta ar bith.

mboilgeog cheart gorm saighead Airteagail gaolmhara


Uirlisí Táirgiúlachta Oifige is Fearr

Kutools le haghaidh Outlook - Níos mó ná 100 Gnéithe cumhachtacha chun do Outlook a shárú

🤖 Cúntóir Ríomhphoist AI: Ríomhphoist pro toirt le draíocht AI - aon-cliceáil chun freagraí genius, ton foirfe, máistreacht ilteangach. Trasfhoirmigh ríomhphost gan stró! ...

📧 Uathoibriú Ríomhphoist: As Oifig (Ar fáil do POP agus IMAP)  /  Sceideal Seol Ríomhphoist  /  Auto CC/BCC de réir Rialacha Agus Ríomhphost á Sheoladh  /  Auto Ar Aghaidh (Ardrialacha)   /  Beannacht Auto Cuir leis   /  Scoilt Ríomhphoist Ilfhaighteoirí go huathoibríoch i dTeachtaireachtaí Aonair ...

📨 Bainistíocht Ríomhphost: Ríomhphoist a Athghairm go héasca  /  Bloc Ríomhphoist Scam ag Ábhair agus Daoine Eile  /  Scrios Ríomhphoist Dúblacha  /  Cuardach Casta  /  Comhdhlúthaigh Fillteáin ...

📁 Ceangaltáin ProSábháil Baisc  /  Baisc Dícheangail  /  Comhbhrú Baisc  /  Auto Sábháil   /  Auto Dícheangail  /  Comhbhrúite Auto ...

🌟 Draíocht Chomhéadain: 😊Níos mó Emojis Pretty and Cool   /  Treisiú Do Tháirgiúlacht Outlook le Radhairc Tabbed  /  Íoslaghdaigh Outlook In ionad Deiridh ...

???? Wonders aon-cliceáil: Freagair Gach Duine le Ceangaltáin Isteach  /   Ríomhphoist Frith-Iascaireachta  /  🕘 Taispeáin Crios Ama an tSeoltóra ...

👩🏼‍🤝‍👩🏻 Teagmhálaithe & Féilire: Baisc Cuir Teagmhálacha Ó Ríomhphoist Roghnaithe  /  Roinn Grúpa Teagmhála ar Ghrúpaí Aonair  /  Bain Meabhrúcháin Breithlá ...

Thar Gnéithe 100 Fan le do Thaiscéalaíocht! Cliceáil Anseo le Tuilleadh Amach.

 

 

Comments (8)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Just tried this on Microsoft® Outlook® for Microsoft 365 MSO (Version 2310 Build 16.0.16924.20054) 64-bit and it was unsuccessful
This comment was minimized by the moderator on the site
Hi there,

Please go to File > Options > Trust Center > Trust Center Settings > Macro Settings. And select the Enable all macros option. After making this change, restart Outlook, the macro should then be operational.
This comment was minimized by the moderator on the site
Hi guys,

does this code also work for Microsoft outlook 365?
I have tried and tried again, but I get no results.
Thanks.
This comment was minimized by the moderator on the site
I couldn't get this macro to work either.
This comment was minimized by the moderator on the site
Hi there,
We've updated the code, please try it again. 🙂
Amanda
This comment was minimized by the moderator on the site
I cannot get this macro to work at all.  All folders in the Folder pane are not expanded at all.  I am using Outlook 2021.  Is there some instruction I missed?
This comment was minimized by the moderator on the site
Hi there,
We've updated the code, please try it again. 🙂
Amanda
This comment was minimized by the moderator on the site
Thank you so much.. It solved my problem. :)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations