I am trying to write a macro of words that selects everything that is heading 2 (or any particular style), copies it and pastes it into an Excel document. The macro recording does not work here, and I do not understand how the syntax of the necessary commands is. Can this be done?
PS It would be great if he could choose any style that the cursor was based on (i.e., if you click on heading 1 and then run the macro, it selects everything in heading 1), but I doubt that it is close to opportunities.
Thank you very much, and I hope that I will receive answers soon (without any luck today).
Pavja2
This is what I have so far (note, I don’t have IDEA how to do an excellent thing, so if anyone knows this will be a big help):
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles( _
"Heading 2,Heading 2 Char Char2 Char1,Heading 2 Char1 Char Char1 Char,Heading 2 Char Char Char Char1 Char,Heading 2 Char1 Char Char Char1 Char Char1,Heading 2 Char Char Char Char Char1 Char Char,Heading 2 Char2 Char Char Char Char Char,Heading 2 Cha" _
)
Selection.Find.ParagraphFormat.Borders.Shadow = False
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Copy
So, can anyone figure this out ...? Bump ... I really need answers to this ...
user185296
source
share