Answer the question
In order to leave comments, you need to log in
Help me write VBA code for MS OFFICE?
Gentlemen, help me solve the following problem. We need a macro that would find the desired line in the word file, for example "@here" and insert the contents from the buffer here. Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Seems to work:
Sub Replace()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "@here"
.Replacement.Text = "^c"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question