Problem with simple macro

I am having a problem with a very simple macro. This may have something to do with other problems we are having with Office 365 programs. I stripped a one page document down to one line for testing.
The line reads as follows:

___ Home Office Deduction 75.XX Net Operating Losses 300.00

Placing the cursor at the beginning of the line I recorded a macro to find .XX and then put a space between the two XXs. Then jump to the end of the line.
Simple right?
No. The macro runs but puts the space at the beginning of the line.
I have recorded it multiple times, all with the same outcome.
I have attached the file for testing.
LVL 1
Bill GoldenExecutive Managing MemberAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MacroShadowCommented:
This works for me:
Option Explicit

Sub Macro1()
    Selection.HomeKey Unit:=wdLine
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "XX"
        .Replacement.Text = "X X"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = True
        .MatchWholeWord = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.EndKey Unit:=wdLine
End Sub

Open in new window

0
Bill GoldenExecutive Managing MemberAuthor Commented:
I guess I failed to define the goal. The macro we bill more extensive in the end. I am just trying to decide what I am doing wrong in that I cannot see to get a basic macro to work. Any thoughts?
0
MacroShadowCommented:
Well, being as you haven't shown us your code, no, no thoughts.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Bill GoldenExecutive Managing MemberAuthor Commented:
Well, when I recorded the macro, Word produced the following code:

Sub Macro1()
'
' Macro1 Macro
'
'
    CommandBars("Navigation").Visible = False
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.TypeText Text:=" "
    Selection.EndKey Unit:=wdLine
End Sub

Which of course is pure crap since it did not work. What I am trying to figure out is WHY?
0
MacroShadowCommented:
You didn't record the search and replace.
Look at the code I posted, it is from a recording doing what you asked.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Neil FlemingConsultant and developerCommented:
Hi Bill, as MacroShadow says, your code is not searching for the XX.

All that your code does is move one character to the right of whatever text is selected, then move one character left (for some reason), then types a space. Maybe you accidentally started recording after finding the XX.
0
Bill GoldenExecutive Managing MemberAuthor Commented:
I have discovered why the Macro was not recording the step. In performing the step, the find result is accomplished but you cannot X out of the step. If you do, the Macro does not include that function.

Thanks guys.
0
Bill GoldenExecutive Managing MemberAuthor Commented:
I have discovered why the Macro was not recording the step. In performing the step, the find result is accomplished but you cannot X out of the step. If you do, the Macro does not include that function.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.