Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Word Macro or Advice

Status
Not open for further replies.

bobnplano

Technical User
Mar 25, 2003
52
US
I am still a novice user here - I am using Windows 10 on a PC and using Microsoft Word 365. I am a retired preacher and trying to write bible studies and here is my dilemma:

The word "Lord" or "LORD" is used in the Bible quite often, of course. I have found myself typing the word "LORD" and then going back and selecting the "ORD" in the word and choosing a smaller font so that it appears with a large "L" and small "ORD", or selecting the "L" and making it bigger by about 50% so the letters "ORD" remain the size font I am typing in. I sometimes write using different fonts or different size fonts. So, what I'm asking is this: can a MACRO be made so that before I type the word lord, I would hit my MACRO or turn the MACRO on, type the word lord and it will automatically capitalize all four letters as I type them and make the first letter larger in proportion to the rest of the word (perhaps 50% larger). I would then turn off the MACRO off. I would not want the MACRO to stay on as there are of course other times when "lord" is used in all lower case or "Lord". I will also sometimes copy a Bible text from my Logos Bible Software and pasted it in my writing, but still have to select the letters and change the font size. I've been doing this for years but it does slow me down when I'm on a roll in writing and have to stop to change the way "LORD" is supposed to appear. Only a Bible student would understand the difference in the meaning of "LORD" vs. "lord." Can you help me or give me a better solution.

Thanks in advance,

Bob Lankford
 
 https://files.engineering.com/getfile.aspx?folder=3c5157f2-3dd4-47c3-96ee-56043d10cee0&file=lord_font_size.docx
Hi,

The LORD said unto my Lord, Sit thou at my right hand, until I make thine enemies thy footstool.

Just to be clear. In cases where the typed result is all caps, as in the translation of YHWH, you want to be able to change the capital font size of all but the leading character. But is the case of Lord you don't? I know that's how the type was set for the Schofield Reference Bible, mine from when we had BRoadway as our telephone exchange code, as written by my mother on the flyleaf.

BTW, you can SELECT the entire word and SHIFT+F3 to cycle thru sever capitalization options.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
How about writing a couple of Macros where (let’s say keyboard shortcut Alt-L) will place a word ‘Lord’ at the cursor, and Alt-D will place word ‘LORD’ with an ’L’ increased in size? Would that work?

Code:
Option Explicit

Sub Lord()[green]
' Lord Macro[/green]
    Selection.TypeText Text:="Lord"
End Sub

Sub Macro1()[green]
' Macro1 Macro[/green]
    With Selection
        .TypeText Text:="LORD"
        .MoveLeft Unit:=wdCharacter, Count:=3
        .MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
        With .Font
            .Grow
            .Grow
            .Grow
            .Grow
            .Grow
        End With
        .MoveRight Unit:=wdCharacter, Count:=4
    End With
End Sub


---- Andy

There is a great need for a sarcasm font.
 
None of this messing around with font sizes isn't at all useful. All you need is a wildcard Find/Replace, where:
Find = L[Oo][Rr][Dd]
Replace = Lord
and you set the replacement font to 'small caps'.

Or, as a macro:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "L[Oo][Rr][Dd]"
    .Replacement.Text = "Lord"
    .Replacement.Font.SmallCaps = True
    .Format = True
    .Forward = True
    .MatchWildcards = True
    .Wrap = wdFindStop
    .Execute Replace:=wdReplaceAll
  End With
End With
Application.ScreenUpdating = True
End Sub
To limit the macro's scope to just a selected range, change 'ActiveDocument' to 'Selection'.

If you really want to increase the font size as well simply add:
.Replacement.Font.Size = 15
before:
.Format = True
where the '15' is the preferred font size.

Cheers
Paul Edstein
[MS MVP - Word]
 
Ahhhhh, thank you all for the options. I will probably try them all to see which serves me best. As always, I get the best help here at Tek-tips. You're all amazing!

Bob
 
Andrzejek:

I like what your Macro does, and it works fine when you open the Macro and click "Run". However, nothing happens when I use the shortcut "Alt L" or "Alt D". Am I missing something? I've even tried starting the Macro Record over and assigning the keyboard shortcut "Alt L" and "Alt D" but they still won't run the Macro. Am I forgetting something? Please advise.

Bob
 
It was always a mystery to me as to where and how Word keeps track of the keyboard shortcuts to run the macros. Hopefully somebody else, more knowledgeable, can shed some light on the subject. [pc2]

But what you CAN do is – in Word, start Macro Recorder, at the beginning you will be asked to provide a name for this Macro, and at the same time you may establish a keyboard shortcut to your Macro. Then do a few keystrokes, and stop the Macro Recorder. Then you can go to the code of that Macro (Alt-F11) and replace the code generated with the code I gave you between [tt]Sub Macro1[/tt] and [tt]End Sub[/tt]. Then you will have your new macro with the keyboard shortcut you specified.

Give it a try, learn something new, you will love it.

You may want to see this - how to Assigning a Shortcut Key to a Macro


---- Andy

There is a great need for a sarcasm font.
 
Andrzejek - never mind, I finally got it to work with one modification. Instead of 5 ".Grows" I changed it to only have 4 ".Grows". It is working like a charm, just as I had requested and needed it to.

Thank you so very much.

Bob
 
Surely all the .Grow stuff might be better replaced with the below to more consistently achieve the original request to "mak[e] it bigger by about 50%"

Code:
[blue]Font.Size = Font.Size * 1.5[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top