vba - How to apply macro after a certain page / line in a word document? -
i made macro , wanted apply in text page or right line. in image below shows how wanted apply macro, page 2 , red line, text pasted after red line.
thanks in advance help.
this button codes:
private sub commandbutton1_click() selection.find.clearformatting selection.find.replacement.clearformatting selection.find .text = ".^p" .replacement.text = "!teste!" .forward = true .wrap = wdfindcontinue .format = false .matchcase = false .matchwholeword = false .matchwildcards = false .matchsoundslike = false .matchallwordforms = false end selection.find.execute replace:=wdreplaceall selection.find .text = "^p" .replacement.text = " " .forward = true .wrap = wdfindcontinue .format = false .matchcase = false .matchwholeword = false .matchwildcards = false .matchsoundslike = false .matchallwordforms = false end selection.find.execute replace:=wdreplaceall selection.find .text = "!teste!" .replacement.text = ".^p" .forward = true .wrap = wdfindcontinue .format = false .matchcase = false .matchwholeword = false .matchwildcards = false .matchsoundslike = false .matchallwordforms = false end selection.find.execute replace:=wdreplaceall end sub private sub commandbutton2_click() selection.wholestory selection.paragraphformat.alignment = wdalignparagraphjustify selection.paragraphformat .spacebeforeauto = false .spaceafterauto = false .firstlineindent = centimeterstopoints(1.25) end end sub
Comments
Post a Comment