D
david.f.jenkins
I can't compose the VBA that will solve this seemingly simple problem
for me.
in regexspeak, suppose I have this text:
(\S|^) *(->) *(\S|$). I could have, for instance:
->b
a->
a->b
a ->b
a-> b
a -> b
a -> b
..
..
..
well, you get this picture.
I want to replace the "->" with the Wingdings character 170 symbol and
always end up with:
(\S|^) [the wingdings symbol] (\S|$)
Here's the hooker: I want retain the original fonts for group 1 and 2
(or a and b, in my examples above).
This code will replace all the arrows for me just fine, while retaining
the fonts:
sub wingdings(tRange as textrange)
dim foundArrrow as textrange
Set foundArrow = tRange.find(findwhat:="->")
Do While Not (foundArrow Is Nothing)
foundArrow.Characters(1, 2).InsertSymbol fontName:="Wingdings 3",
CharNumber:=170, Unicode:=msoTrue
Set foundArrow = tRange.find(findwhat:="->")
Loop
end sub
But I still have the vexing problem of maintaining the fonts while
trying to surround the Wingdings character with a *single* space.
I've chewed at this thing for a few hours, and always seem to end up
finding a case where the fonts don't end up right.
Anyone care to give it a go?
for me.
in regexspeak, suppose I have this text:
(\S|^) *(->) *(\S|$). I could have, for instance:
->b
a->
a->b
a ->b
a-> b
a -> b
a -> b
..
..
..
well, you get this picture.
I want to replace the "->" with the Wingdings character 170 symbol and
always end up with:
(\S|^) [the wingdings symbol] (\S|$)
Here's the hooker: I want retain the original fonts for group 1 and 2
(or a and b, in my examples above).
This code will replace all the arrows for me just fine, while retaining
the fonts:
sub wingdings(tRange as textrange)
dim foundArrrow as textrange
Set foundArrow = tRange.find(findwhat:="->")
Do While Not (foundArrow Is Nothing)
foundArrow.Characters(1, 2).InsertSymbol fontName:="Wingdings 3",
CharNumber:=170, Unicode:=msoTrue
Set foundArrow = tRange.find(findwhat:="->")
Loop
end sub
But I still have the vexing problem of maintaining the fonts while
trying to surround the Wingdings character with a *single* space.
I've chewed at this thing for a few hours, and always seem to end up
finding a case where the fonts don't end up right.
Anyone care to give it a go?