View Single Post
 
Old 06-08-2025, 11:49 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I don't propose to work through & debug 300+ lines of code.

What you could do is something like:
Code:
For Each para In myRange.Paragraphs
    If para.Style = "Distribution List Name" Then
        'Remove paragraph break & clean up name by deleting anything after a comma,
        'which indicates a managing committee member or a job title.
        strDistName = Trim(Split(Split(para.Range.Text, vbCr)(0), ",")(0))
        If strDistName <> "" Then
            intNameCount = intNameCount + 1
            Call UpdateProgress(intNameCount)
            Select Case strDistName
                Case "Federal Reserve Board", "Office of the Comptroller of the Currency", "Ernst & Young LLP", "Central Bank of Ireland"
                Case "Narayan Subramaniam" 'resolves to NarayanSubramaniamDirects@usbank.com
                    strTransmittalList = strTransmittalList & vbCr & "NarayanSubramaniamDirects@usbank.com" & ";"
                Case "Mazars" 'resolves to Mazarsdata@usbank.onmicrosoft.com
                    strTransmittalList = strTransmittalList & vbCr & "Mazarsdata@usbank.onmicrosoft.com" & ";"
                Case "David Wright"
                    strTransmittalList = strTransmittalList & vbCr & "hard-coded email address" & ";" 'Insert hard-coded email address here
                Case "Peter Gaertner"
                    strTransmittalList = strTransmittalList & vbCr & "hard-coded email address" & ";" 'Insert hard-coded email address here
                Case Else
                    'Attempt to resolve
                   ......
            End Select
and/or:
Code:
For Each k In Dict_People.Keys
    If Dict_People(k) > 0 Then
        strPerson = k
        Select Case strPerson
        Case "David Wright", "Peter Gaertner"
        Case Else: strExceptions = strExceptions & strPerson & vbCr
        End Select
    Else
        'Ok
    End If
Next k
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote