Getting and setting font size of found text



Dear Friends,

I'm trying to write a macro that reduces the size of each
chunk of text formatted with a specific font to a percentage
of the font size of that chunk, i.e. if a certain chunk of
text is 18pt Arial it should become 10.5pt Arial (yes I know
18*0.6 = 10.8, but Word apparently rounds down to the
nearest half point, which is good enough for me), if another
chunk is 12pt Arial it should become 7pt (~7.2) and so on.
The macro I've written is as follows:

* Sub Smaller()
* With Selection.Find
* .ClearFormatting
* .Font.Name = "Arial"
* mySize = Selection.Font.Size
* With .Replacement
* .Font.Size = mySize * 0.6
* End With
* .Execute Replace:=wdReplaceAll, Forward:=True, _
* Wrap:=wdFindContinue
* End With
* End Sub

It does wrong in that it sets all text formatted in Arial to
..6 times the size of the first character in the document --
regardless of what font it is. Can someone tell me how to
correct this?

TIA,

/BP

.



Relevant Pages

  • Re: How do I paste text into Word in the documents font face?
    ... No, you'd have to run the macro manually, for example, by adding it to ... Sub EditPaste() ... >> Stefan Blom ... >>> feature of retaining the original font and text characteristics. ...
    (microsoft.public.word.docmanagement)
  • Re: EXCEL VALUE PASTING
    ... "CANNOT EDIT A MACRO ON A HIDDEN WORKBOOK.UNHIDE THE WORKBOOK USING THE ... Sub LowerCase() ... way to list all existing shortcut keys. ... changing case and font size. ...
    (microsoft.public.excel.programming)
  • Re: My idea of fully-portable C code
    ... The reasoning behind that choice of encoding is flawed. ... The chunk size is determined by BITS_PER_CHUNK. ... A macro is a self-contained, ... able to be used on its own without parentheses. ...
    (comp.arch.embedded)
  • Re: using Line Input
    ... string in the next chunk. ... Private Sub Class_Initialize ... Public Function ReadDelineatedLine() As String ... ' --- Was this the last Field of the Last Buffer ...
    (microsoft.public.vb.general.discussion)
  • RE: EXCEL VALUE PASTING
    ... "CANNOT EDIT A MACRO ON A HIDDEN WORKBOOK.UNHIDE THE WORKBOOK USING THE ... changing case and font size. ... name in the list, press the button, and assign a shortcut key. ... Sub Lowercase() ...
    (microsoft.public.excel.programming)

Quantcast