Hi
The VBA help files show that the .Position property returns a Long integer,
not a string. When you set the .Position as "2.5", Word will perform an
implicit conversion, and convert this to a Long, which is 2.
The real problem, however, is that through the user interface you can set
the position (raised or lowered) in half points, and Word respects your
choice. But the object model exposed to VBA only allows you to set it in
whole numbers (because it's a long integer). So from what I can see, you can
do the search-and-replace using the user interface, but you can't search for
text raised 2.5pts in VBA.
By the way, if you're only searching for formatting (and not text) you can
specify that the .Text and .Replacement.Text is just "". And, you might want
to set the .Continue property. So something like:
With Selection.Find
.Text = ""
.Font.Position = 2
.Replacement.Text = ""
.Forward = True
.Format = True
.MatchWildcards = False
.Wrap = wdFindContinue
End With
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
>I am writing in regard to what appears to me to be a bug in the macro
> processor for Word... though it may be that I am doing something wrong.
[quoted text clipped - 37 lines]
>
> /John
paleoWordFan - 31 Jul 2007 08:36 GMT
Thanks for your answer Shauna. I figured that it may be a type mismatch
problem (which is a bug to me). But when I tried to correct the number in the
macro to numeric --
.Font.Position = 2.5
The same problem occurs. Macro runs it with 2 rather than 2.5. I know that
because when i click on the "Replace" command, the formating shown is Raised
2 points rather than Raised 2.5
How to over come this?
I am aware of the null filler option. But this is a specific conversion macro.
Thanks
/John
> Hi
>
[quoted text clipped - 68 lines]
> >
> > /John
After recording a macro and looking at the results, it was
Selection.Font.Position = 2.5
Without the quote marks.
> I am writing in regard to what appears to me to be a bug in the macro
> processor for Word... though it may be that I am doing something wrong.
[quoted text clipped - 36 lines]
>
> /John

Signature
Russ
drsmN0SPAMikleAThotmailD0Tcom.INVALID
paleoWordFan - 31 Jul 2007 09:06 GMT
Yes, I put in the quotation marks because I was trying to get the macro to
work.
Either way --
Selection.Font.Position = 2.5
or
Selection.Font.Position = "2.5"
It does not work. Try it out. I believe it is a bug.
/John
> After recording a macro and looking at the results, it was
> Selection.Font.Position = 2.5
[quoted text clipped - 40 lines]
> >
> > /John
Klaus Linke - 31 Jul 2007 12:01 GMT
Yes, it is a bug that was introduced when the macro language changed from
WordBasic to VBA.
As Shauna said, .Position was wrongly defined as Long (that is, an integer).
WordBasic should still work:
With WordBasic
.EditFindClearFormatting
.EditReplaceClearFormatting
.EditFindFont Position:="2.5"
.EditFind Find:="", Format:=1, Wrap:=1
End With
Regards,
Klaus
> Yes, I put in the quotation marks because I was trying to get the macro to
> work.
[quoted text clipped - 59 lines]
>> >
>> > /John
Klaus Linke - 31 Jul 2007 12:09 GMT
To change all text that's raised 2.5 pt to 3 pt:
With WordBasic
.EditFindClearFormatting
.EditReplaceClearFormatting
.EditFindClearFormatting
.EditFindFont Position:="2.5"
.EditReplaceFont Position:="3"
.EditReplace Format:=1, Wrap:=1, ReplaceAll:=True
End With
Then you can use VBA to do the rest...
Regards,
Klaus
paleoWordFan - 31 Jul 2007 13:56 GMT
Thank you very much, Klaus! I tried it and it works!
Regards
/John
> To change all text that's raised 2.5 pt to 3 pt:
>
[quoted text clipped - 11 lines]
> Regards,
> Klaus