View Single Post
 
Old 08-03-2023, 03:24 PM
GDA63378 GDA63378 is offline Windows 10 Office 2019
Novice
 
Join Date: Aug 2023
Posts: 4
GDA63378 is on a distinguished road
Default Help with debugging fairly simple "selection.cut" error.

Help with debugging fairly simple (I hope) "selection.cut" error.

Ok, I 'wrote' these macros back in 2010... basically the system basically recorded my actions and saved into code. These have worked ever since and I've forgotten a lot... and I knew almost nothing to begin with! Anyways, one section is now erroring out. I've changed nothing, same Word I've been using for some time now, same code I've been using for well over a decade. I don't even remember what EXACTLY SPECIFICALLY these do anymore, just that they work for what I need.

I've edited my post to hopefully just show the relevant section versus the entire code. Here's the sub-section I've having issues with. It's erroring out at 'selection.cut'.

--------------------------------------------------
Selection.Find.Execute
Selection.HomeKey Unit:=wdLine
Selection.MoveUp Unit:=wdScreen, Count:=3, Extend:=wdExtend
Selection.Cut
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p^p^p"
.Replacement.Text = "^p^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
--------------------------------------------------

Basically, this is just part of several macros I use to edit/fix e-Books so they display/view better. It's been a minute, but I think I'm copying everything ABOVE where any "Chapter One" begins, running all the steps, then pasting back in when completed. This worked for years, and now just stopped working.

Sorry if I've made this more difficult than it should be. Calling me a novice at this would be a massive upgrade, I really know nothing. If you do know the fix, please treat me like a total moron and explain so I'd understand what to change.

Greg

Last edited by GDA63378; 08-03-2023 at 08:37 PM.
Reply With Quote