ms word - VBA changing font size of one character in specific string (MSWORD MACRO) -
i trying replace font size of 1 character in specific string.
this 1 creates word want cannot incorporated replace function.
sub logo() selection.collapse direction:=wdcollapseend selection.range .font.reset .text = "example" .characters(2).font.size = 8 end end sub
this 1 replaces whole word. cannot incorporated character function.
sub redofonts() activedocument.content.find .clearformatting .replacement.clearformatting .forward = true .wrap = wdfindcontinue .format = true .matchcase = false .matchwholeword = false .matchwildcards = false .matchsoundslike = false .matchallwordforms = false .text = "example" .replacement.text = "example" .font.size = 12 .replacement.font.size = 9 .execute replace:=wdreplaceall .clearformatting .replacement.clearformatting .font.name = "times new roman" .replacement.font.name = "times new roman" .execute replace:=wdreplaceall end end sub
any way merge these two?
the following code searches active document string "this" , changes "h" in font size of 20.
dim myrange range set myrange = activedocument.content myrange.find.execute findtext:="this", forward:=true if myrange.find.found = true myrange.find.execute findtext:="h", forward:=true if myrange.find.found = true myrange.font.size = 20 end if
Comments
Post a Comment