Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-08-2025, 11:49 PM
macropod's Avatar
macropod macropod is offline Need VBA code to bypass certain logic and use hard-coded information under specific circumstances Windows 10 Need VBA code to bypass certain logic and use hard-coded information under specific circumstances 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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bypass VBA macro password in Excel daniel.smith.10 Excel Programming 2 07-11-2017 01:58 AM
how to enter information to outline code column ketanco Project 3 02-04-2015 03:07 PM
Need VBA code to bypass certain logic and use hard-coded information under specific circumstances Merge not Displaying as Coded Dmo Mail Merge 5 07-24-2014 03:24 PM
writing task logic and task information box ketanco Project 1 06-15-2014 09:02 AM
Retrieving Microsoft Outlook 2007 information after formatted hard disk (C drive) SWEngineer Outlook 0 09-23-2012 01:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:06 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft