vba - Select a paragraph in Word and change it's style -
i need find if line in word document starts word picture, , if does, change style of line built in style. believe line begins after return key interpreted word new paragraph , end of paragraph signified return key.
i have single sentence paragraph, style have change if begins word picture. how can search every line of document see if begins word picture?
--edit--
i have changed word picture figure
i'm trying find instances of figure , convert line containing figure boldface (the boldface code replaced code changes style). have skipped error checks, , trying find instances of figure , convert sentence characters boldface, starting point word figure present.
sub macro1() ' ' macro1 macro ' ' selection.find.clearformatting selection.find .text = "figure" .forward = true .wrap = wdfindstop end selection.find.execute selection.endkey unit:=wdline, extend:=wdextend selection.font.bold = wdtoggle loop end sub
here's screenshot of document
detects first figure in line shown in red circle.
found code keeps detecting first instance of figure current position of insertion point on , on again.
how search next instance of figure after detecting 1 of them?
changing wdfindstop wdfindcontinue not work; both produce same result.
i made modification of code searches first last. change way select whole sentence mark bold.
sub macro1() selection.find.clearformatting selection.find .text = "figure" .forward = true .wrap = wdfindstop end 'changed loop while selection.find.execute 'changed way select sentence selection.expand wdsentence selection.font.bold = true selection.collapse wdcollapseend loop end sub
Comments
Post a Comment