Note: The other languages of the website are Google-translated. Back to English

Conas líon na bhfillteán a chomhaireamh faoi chuntas ríomhphoist sonraithe nó gach bosca poist in Outlook?

Tá an t-alt seo ag caint ar líon na bhfillteán a chomhaireamh faoi chuntas ríomhphoist sonraithe nó faoi gach bosca poist in Outlook.

Líon na bhfillteán a chomhaireamh faoi chuntas ríomhphoist sonraithe nó gach bosca poist le cód VBA

Cluaisín Oifige Cumasaigh Eagarthóireacht agus Brabhsáil Tabbed in Oifig, agus Déan Do Obair i bhfad Níos Éasca ...
Réitíonn Kutools for Excel an chuid is mó de do chuid Fadhbanna, agus Méadaíonn sé do Tháirgiúlacht 80%
  • Athúsáid Rud ar bith: Cuir na foirmlí, na cairteacha agus aon rud eile is úsáidí nó is casta le do rogha Favorites, agus athúsáid go tapa iad sa todhchaí.
  • Níos mó ná 20 gné téacs: Uimhir Sliocht as Teaghrán Téacs; Sliocht nó Bain Cuid de Théacsanna; Tiontaigh Uimhreacha agus Airgeadraí go Focail Bhéarla.
  • Cumaisc Uirlisí: Illeabhair Oibre agus Bileoga ina hAon; Cumaisc Ilchealla / Sraitheanna / Colúin Gan Sonraí a Chailleadh; Cumaisc Sraithe Dúblacha agus Suim.
  • Uirlisí Scoilt: Roinn Sonraí i Ilbhileoga Bunaithe ar Luach; Leabhar Oibre amháin le Ilchomhaid Excel, PDF nó CSV; Colún amháin go Colúin Iolracha.
  • Greamaigh gan bacadh Sraitheanna Hidden / Scagtha; Líon agus Suim de réir Dath Cúlra; Seol Ríomhphoist Phearsantaithe chuig Il-Faighteoirí i mBulc.
  • Scagaire Sármhaith: Ardscéimeanna scagaire a chruthú agus a chur i bhfeidhm ar aon bhileoga; Sórtáil de réir seachtaine, lae, minicíochta agus níos mó; scagairí le cló trom, foirmlí, trácht ...
  • Níos mó ná 300 gné chumhachtach; Oibríonn sé le hOifig 2007-2019 agus 365; Tacaíochtaí le gach teanga; Imscaradh éasca i d’fhiontar nó d’eagraíocht.

Líon na bhfillteán a chomhaireamh faoi chuntas ríomhphoist sonraithe nó gach bosca poist le cód VBA

Féadfaidh tú líon na bhfillteán a chomhaireamh faoi chuntas ríomhphoist sonraithe nó faoi gach bosca poist a bhfuil cód VBA faoi bhun acu. Déan mar a leanas le do thoil.

1. Brúigh an Eile + F11 eochracha a oscailt Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

2. Sa Microsoft Visual Basic d’Fheidhmchláir fuinneog, cliceáil Ionsáigh > Foirm úsáideora. Féach an pictiúr:

3. Ansin cuir isteach dhá Cnaipí Rogha agus beirt Cnaipí Ordú i ÚsáideoirForm1, agus athraigh téacs taispeána na gcnaipí mar atá thíos an pictiúr a thaispeántar.

4. Athraigh ainm an chéad chnaipe rogha go “opbCurAccount”Agus athraigh an luach maoin do True. Féach an pictiúr:

5. Téigh ar ainm an chnaipe dara rogha a athrú go “opbAllAccounts”. Agus ansin ainm an dá chnaipe ordaithe a shonrú chun “cdbOk"Agus"cdbCealaigh”Ar leithligh.

6. Cliceáil faoi dhó ar aon áit bán de UserForm1, agus ansin cuir an cód VBA faoi bhun na fuinneoige Userform1 (Cód) in ionad an chóid bhunaidh.

Cód VBA: Líon na bhfillteán in Outlook

Option Explicit
'Update by Extendoffice 20180504
Public xRet As Boolean
Private Sub cdbCancel_Click()
xRet = False
UserForm1.Hide
End Sub
Private Sub cdbOk_Click()
xRet = True
UserForm1.Hide
End Sub
7. Click Insert > Module. Then copy below VBA code into the Module window.
VBA code: Count number of folders in Outlook
Function GetSubFolderCount(ParentFolder As Folder) As Long
    Dim xSubFolders As Folders
    Dim xCurFolder As Outlook.Folder
    Dim xFoldersCount As Integer
    On Error Resume Next
    Set xSubFolders = ParentFolder.Folders
    If xSubFolders.Count > 0 Then
       Set xCurFolder = xSubFolders.GetFirst
       While TypeName(xCurFolder) = "MAPIFolder"
          xFoldersCount = xFoldersCount + GetSubFolderCount(xCurFolder)
         Set xCurFolder = xSubFolders.GetNext
       Wend
       GetSubFolderCount = xFoldersCount + xSubFolders.Count
    Else
        GetSubFolderCount = 0
    End If
    End Function
    
    Sub CountFoldersInOutlook()
    Dim xNameSpace As NameSpace
    Dim xFolder As Folder
    Dim xAllFoldersCount As Long
    On Error Resume Next
    UserForm1.Show
    If UserForm1.xRet Then
        Set xNameSpace = Outlook.Application.Session
        If UserForm1.opbCurAccount.Value Then
            Set xFolder = Outlook.Application.ActiveExplorer.CurrentFolder.Store.GetRootFolder
            xAllFoldersCount = GetSubFolderCount(xFolder)
        ElseIf UserForm1.opbAllAccounts.Value Then
            For Each xFolder In xNameSpace.Folders
                xAllFoldersCount = xAllFoldersCount + GetSubFolderCount(xFolder)
            Next
        End If
    Else
        Exit Sub
    End If
    MsgBox "Total Folders: " & xAllFoldersCount, vbInformation + vbOKOnly, "Kutools for Outlook"
    End Sub

8. Press the F5 key to run the code. Then a UserForm1 dialog box pops up, for counting number of folders in current account, please select the Current Account option and click the OK button. For counting number of folders in all mailboxes, choose the All Accounts option and then click the OK button. See screenshot:

9. Then a Kutools for Outlook dialog box pops up to tell you how many folders existing in current account or all mailboxes as below screenshot. Please click the OK button.

Note: All hidden folders such as the Conversation Action Settings folder and the Quick Step Settings folder are included in the folder counting.


Related articles:


The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations