I am trying to write a macro to find raised text, specifically, I would like
to be able to find and replace the text raised by 3.5 points.

I wrote a simple macro to simply find the raised text:

' Macro to find text raised by 3 points and it works great
With ActiveDocument.Range.Find
.ClearFormatting
.Font.Position = 3 ' Finds text raised by 3 points
.Execute
End With

However, when I try to find raised text, raised by some decimal value (say)
3.5, the macro simply fails!

' Macro to find text raised by 3.5 points and it fails
With ActiveDocument.Range.Find
.ClearFormatting
.Font.Position = 3.5 ' Finds text raised by 3.5 points
' msgbox(font.position) ' This returns 4!!!! Apparently, I think that
the Font.position parameter is defined as an integer
.Execute
End With


How do I go about this? Is there someway to get it to accept and decimal
values as well? I also tried recording a macro after typing "3.5" in word's
Find and Replace box. The macro recorded doesn't work either and returns 4
as well. Is this some bug?

Thanks for any response.

Vince

Re: Finding text raised by some decimal value by Helmut

Helmut
Sat Mar 12 12:27:02 CST 2005

Hi Vince,

>Thanks for any response

if so, then
some kind of inconsistency, I'd say,
as .font.position is of type long,
according to help.

However, when searching for .Font.Position = 3.5
> .Font.Position = 3.5 ' Finds text raised by 3.5 points
the search is successful.

> ' msgbox(font.position) ' This returns 4!!!!

That's 3.5 rounded.

But you know, it's 3.5

So what's the problem?

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/

Re: Finding text raised by some decimal value by Vince

Vince
Sat Mar 12 22:26:30 CST 2005

Hey Helmut,

Are you sure the search is successful? What am I doing wrong? I just tried
this again:

Example:
Blah blah1 blah blah

The 1 in the example is raised by 3 points.

Code:
Dim A As Range
Set A = ActiveDocument.Range

With A.Find
.ClearFormatting
.Font.Position = 3
.Execute
MsgBox .Found
End With

I get "TRUE" which is good.

Now, the same example, with 1 raised by 3.5 points, and this code:

Dim A As Range
Set A = ActiveDocument.Range

With A.Find
.ClearFormatting
.Font.Position = 3.5


.Execute
MsgBox .Found
End With


gives me a "FALSE" . Why? What I meant was when I add a message box after
the .font.position=3.5, I know it returns a rounded 4 value. I was wondering
if it was looking for a 4 value as well instead of 3.5.

What am I doing wrong and how does it work for you?

Please let me know. Is this clear? Again, I mean that font raised by decimal
points cannot be searched and replaced by code. However, rounded values are
searchable.

Thanks,
Vince


"Helmut Weber" <elmkqznfwvccbf@mailinator.com> wrote in message
news:acc6315504ipu34j275pgfm0bv2lsvpg5v@4ax.com...
> Hi Vince,
>
>>Thanks for any response
>
> if so, then
> some kind of inconsistency, I'd say,
> as .font.position is of type long,
> according to help.
>
> However, when searching for .Font.Position = 3.5
>> .Font.Position = 3.5 ' Finds text raised by 3.5 points
> the search is successful.
>
>> ' msgbox(font.position) ' This returns 4!!!!
>
> That's 3.5 rounded.
>
> But you know, it's 3.5
>
> So what's the problem?
>
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word XP, Win 98
> http://word.mvps.org/



Re: Finding text raised by some decimal value by Helmut

Helmut
Sun Mar 13 04:07:47 CST 2005

Hi Vince,

sorry, I tested it manually by typing in the reach and replace
dialog "3,5 pt" (german version), which works.
However, every trial to use 3.5 programmatically
or even feeding "3,5 pt" to the dialog using sendkeys failed.

Maybe someone else will come up with a workaraound.

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/





Re: Finding text raised by some decimal value by Vince

Vince
Sun Mar 13 04:17:38 CST 2005

Hey Helmut,

Thanks for your response.

Well, I am at my wit's end. I guess the only solution (more a workaround) is
to use a range which cycles through each letter in the document and do a "if
Rangevariable.font.position>3 then blah blah".

I didn't know that Germans use a "," instead of a ".". Over here (in HK -
China), they still use a "." but, many other things are way different.

Vince

"Helmut Weber" <elmkqznfwvccbf@mailinator.com> wrote in message
news:vq38311jtr9vsdtb66ussvf6nfh5slikuo@4ax.com...
> Hi Vince,
>
> sorry, I tested it manually by typing in the reach and replace
> dialog "3,5 pt" (german version), which works.
> However, every trial to use 3.5 programmatically
> or even feeding "3,5 pt" to the dialog using sendkeys failed.
>
> Maybe someone else will come up with a workaraound.
>
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word XP, Win 98
> http://word.mvps.org/
>
>
>
>



Re: Finding text raised by some decimal value by Klaus

Klaus
Mon Mar 14 11:56:30 CST 2005

Hi Vince, Helmut,

The VBA folks defined .Position as a Long (integer), so it seems it =
can't handle half-integer values.

I wonder if WordBasic could come to the rescue? Or maybe the bug is =
already older than VBA...

Regards,
Klaus


"Vince" <nmvkPLEASERMVTHIS@vsnl.net> wrote:
> Hey Helmut,
>=20
> Thanks for your response.
>=20
> Well, I am at my wit's end. I guess the only solution (more a =
workaround) is=20
> to use a range which cycles through each letter in the document and do =
a "if=20
> Rangevariable.font.position>3 then blah blah".
>=20
> I didn't know that Germans use a "," instead of a ".". Over here (in =
HK -=20
> China), they still use a "." but, many other things are way different.
>=20
> Vince
>=20
> "Helmut Weber" <elmkqznfwvccbf@mailinator.com> wrote in message=20
> news:vq38311jtr9vsdtb66ussvf6nfh5slikuo@4ax.com...
> > Hi Vince,
> >
> > sorry, I tested it manually by typing in the reach and replace
> > dialog "3,5 pt" (german version), which works.
> > However, every trial to use 3.5 programmatically
> > or even feeding "3,5 pt" to the dialog using sendkeys failed.
> >
> > Maybe someone else will come up with a workaraound.
> >
> > Greetings from Bavaria, Germany
> >
> > Helmut Weber, MVP
> > "red.sys" & chr(64) & "t-online.de"
> > Word XP, Win 98
> > http://word.mvps.org/
> >
> >
> >
> >=20
>=20
>

Re: Finding text raised by some decimal value by Klaus

Klaus
Mon Mar 14 12:05:48 CST 2005

[WordBasic to the rescue]

This seems to work:
WordBasic.EditFindFont Position:=3D"3.5"=20
WordBasic.EditFind Find:=3D"", Format:=3D1

(at least in the German version with "3,5" instead of "3.5")

Regards,
Klaus

Re: Finding text raised by some decimal value by Vince

Vince
Mon Mar 14 20:56:24 CST 2005

Thanks a lot Klaus! I didn't expect Wordbasic to work. I
guess 'Old is gold'.

Vince

>-----Original Message-----
>[WordBasic to the rescue]
>
>This seems to work:
>WordBasic.EditFindFont Position:="3.5"
>WordBasic.EditFind Find:="", Format:=1
>
>(at least in the German version with "3,5" instead
of "3.5")
>
>Regards,
>Klaus
>.
>