Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-12-2023, 07:20 AM
syl3786 syl3786 is offline Simple issue: formatting mroe than one text just using one module Windows 10 Simple issue: formatting mroe than one text just using one module Office 2019
Advanced Beginner
Simple issue: formatting mroe than one text just using one module
 
Join Date: Jan 2023
Posts: 97
syl3786 is on a distinguished road
Question Simple issue: formatting mroe than one text just using one module

Hi all,





I want to use just one module to format more than one text. How to do that?


For instance, I want to italicise the text "et al" and "apple". But i am stupid to use two modules to italicise them separately.



Below please find the code:


Code:
Sub formatting()


  Selection.Find.ClearFormatting
  Selection.Find.Replacement.ClearFormatting

  Selection.Find.Replacement.Font.Italic = True
  With Selection.Find
    .Text = "et al"
    .Forward = True
    .Wrap = wdFindContinue
    .MatchCase = True
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
  End With
  Selection.Find.Execute Replace:=wdReplaceAll


Call Apple


End Sub


Sub Apple()


  Selection.Find.ClearFormatting
  Selection.Find.Replacement.ClearFormatting

  Selection.Find.Replacement.Font.Italic = True
  With Selection.Find
    .Text = "Apple"
    .Forward = True
    .Wrap = wdFindContinue
    .MatchCase = True
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
  End With
  Selection.Find.Execute Replace:=wdReplaceAll

End Sub

May I ask how to use just one module to italicise the text "et al" and "apple"?

Thank you.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Standard Module, Class Module and UserForm jpl Word VBA 0 03-14-2022 07:20 AM
So simple, it may be hard to explain... (mouse issue) Jonesey Excel 1 07-03-2020 11:30 AM
Simple issue: formatting mroe than one text just using one module Restrict Formatting Issue - pasted text changes page size bclear16 Word 6 08-22-2016 11:31 PM
Word Formatting Issue: Space above text when linked to Excel JDHeisenberg Word 3 08-19-2016 05:34 AM
AZWizard Module - ?hidden module pcaldwell Word 1 08-22-2012 01:19 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:34 AM.


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