Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-02-2020, 02:39 PM
John 4 John 4 is offline Counting the number of changes a macro makes Windows 10 Counting the number of changes a macro makes Office 2013
Advanced Beginner
Counting the number of changes a macro makes
 
Join Date: Oct 2019
Posts: 68
John 4 is on a distinguished road
Default

That works perfectly of course Andrew. Thank you.

I nearly had it, but when it comes to codes, 'nearly' is useless.

And thanks for replying so quickly.
Reply With Quote
  #2  
Old 09-02-2020, 04:52 PM
John 4 John 4 is offline Counting the number of changes a macro makes Windows 10 Counting the number of changes a macro makes Office 2013
Advanced Beginner
Counting the number of changes a macro makes
 
Join Date: Oct 2019
Posts: 68
John 4 is on a distinguished road
Default

I’m embarrassed that I have another problem so soon, and after this I promise that I won’t ask any more questions for at a least a month. I have 1000s of other things to do and I’m sure you do too. My notion of using your solution as a template for other macros has failed miserably.

The first part of the following macro is the code you gave me yesterday. It deletes the red footnote numbers. My idea was to copy and paste the “Do While” loop onto the end of the second part after removing the “Selection.Find.Execute Replace:=wdReplaceAll” line. Evidently my plan wasn’t fool-proof.

At the minute the code works great – it cleans up the red footnotes that have been moved into the text. It deletes the footnote numbers and then changes the size and colour of the footnotes (which are now in the text) to match the size and colour of the surrounding text.

But when I try to add the loop to the end of the second part (which is also the end of the macro) so that I can count the changes, it won’t loop, it only makes one change and then stops.


Sub CleanupMovedFootnotes()
' Delete Red in-text footnote numbers
Dim x As Long
With Selection.Find
.ClearFormatting
.Font.Color = wdColorRed
.Replacement.ClearFormatting
.Text = "^2 "
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
Do While .Execute(Replace:=wdReplaceOne)
x = x + 1
Loop
End With

' Change in-text Red Size 9 To Black Size 10
With Selection.Find.Font
.Size = 9
.Color = wdColorRed
End With

With Selection.Find.Replacement.Font
.Size = 10
.Color = wdColorAutomatic
End With

With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
MsgBox "Replaced: " & x
End Sub
Reply With Quote
  #3  
Old 09-02-2020, 06:30 PM
John 4 John 4 is offline Counting the number of changes a macro makes Windows 10 Counting the number of changes a macro makes Office 2013
Advanced Beginner
Counting the number of changes a macro makes
 
Join Date: Oct 2019
Posts: 68
John 4 is on a distinguished road
Default

Here's a test sample for you to try it on, if that helps. [edited to remove attachment at request of poster]

Last edited by Charles Kenyon; 11-10-2020 at 02:07 PM. Reason: remove attachment at request of poster
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting the number of changes a macro makes need help in counting the number of rows that contain 5 consecutive X Marcia Excel 10 11-25-2018 08:41 PM
Counting the number of changes a macro makes Counting rows with a macro? Jennifer Murphy Word Tables 1 08-23-2016 03:00 PM
Counting the number of changes a macro makes Counting the number of opening of a document sannhei Word 2 03-27-2015 05:40 AM
Counting unique visitors by ward, counting monthly visits by status, editing existing workbook JaxV Excel 9 11-14-2014 12:25 AM
Counting the number of changes a macro makes Counting Number of Months from a static date bremen22 Excel 4 11-25-2013 11:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:23 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