Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-29-2023, 12:07 PM
Teknogamer Teknogamer is offline Macro to change font size Windows 11 Macro to change font size Office 2016
Novice
Macro to change font size
 
Join Date: Jun 2023
Posts: 11
Teknogamer is on a distinguished road
Default Macro to change font size

Hi, pretty new to macros and was just trying to make a simple one to change the font size of highlighted text. I hit record, changed the font size and then stopped it, and that macro, when activated, did nothing.


If it helps, here's the code for that macro:
Sub Size10()


'
' Size10 Macro
'
'
mySel = Selection.Font.Size
mySel = 10
End Sub


Any help would be appreciated, thanks!
Reply With Quote
  #2  
Old 06-29-2023, 01:08 PM
rollis13's Avatar
rollis13 rollis13 is offline Macro to change font size Windows 11 Macro to change font size Office 2016
Competent Performer
 
Join Date: Jan 2021
Location: Cordenons
Posts: 140
rollis13 will become famous soon enough
Default

You did something wrong when you recorded the macro. If done correctly this is what you were supposted to find:
Code:
Option Explicit
Sub Size10()
'
' Size10 Macro
'
'
    Selection.Font.Size = 10
End Sub
Reply With Quote
  #3  
Old 06-30-2023, 01:02 AM
Teknogamer Teknogamer is offline Macro to change font size Windows 11 Macro to change font size Office 2016
Novice
Macro to change font size
 
Join Date: Jun 2023
Posts: 11
Teknogamer is on a distinguished road
Default

You're correct, the code I posted was from one macro that I fooled around with (with 0 knowledge on the topic, as is apparent, lol). But the macros naturally recorded like you wrote it.
For some reason, all of those size macros are working today. Don't know what changed...
Reply With Quote
  #4  
Old 06-30-2023, 02:48 AM
rollis13's Avatar
rollis13 rollis13 is offline Macro to change font size Windows 11 Macro to change font size Office 2016
Competent Performer
 
Join Date: Jan 2021
Location: Cordenons
Posts: 140
rollis13 will become famous soon enough
Default

That's okay, as long as it works .
Reply With Quote
  #5  
Old 06-30-2023, 06:57 AM
Teknogamer Teknogamer is offline Macro to change font size Windows 11 Macro to change font size Office 2016
Novice
Macro to change font size
 
Join Date: Jun 2023
Posts: 11
Teknogamer is on a distinguished road
Default

I figured out the issue...this makes no sense. The macro works on english (regular left to right font), but when I use hebrew (right to left font) it doesn't work. Any ideas?
Reply With Quote
  #6  
Old 06-30-2023, 07:06 AM
Teknogamer Teknogamer is offline Macro to change font size Windows 11 Macro to change font size Office 2016
Novice
Macro to change font size
 
Join Date: Jun 2023
Posts: 11
Teknogamer is on a distinguished road
Default

Ok managed to solve this myself by googling it. In case anyone else gets stuck with this I learned that apparently VB has different character attributes for right to left languages, and the term bi needs to be added.

So the following change made it work:
Code:
Sub Size14()
'
' Size14 Macro
'
'
    Selection.Font.Size = 14
    Selection.Font.SizeBi = 14
End Sub
(Source: vba - How can I change the font size of non-English words? - Stack Overflow)
Reply With Quote
  #7  
Old 06-30-2023, 07:37 AM
rollis13's Avatar
rollis13 rollis13 is offline Macro to change font size Windows 11 Macro to change font size Office 2016
Competent Performer
 
Join Date: Jan 2021
Location: Cordenons
Posts: 140
rollis13 will become famous soon enough
Default

Thanks for sharing, always helpful.
Reply With Quote
  #8  
Old 06-30-2023, 11:02 AM
Charles Kenyon Charles Kenyon is offline Macro to change font size Windows 11 Macro to change font size Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Use styles, not macros, for formatting.

The Importance of Styles in Microsoft Word
Reply With Quote
  #9  
Old 07-02-2023, 12:12 AM
Teknogamer Teknogamer is offline Macro to change font size Windows 11 Macro to change font size Office 2016
Novice
Macro to change font size
 
Join Date: Jun 2023
Posts: 11
Teknogamer is on a distinguished road
Default

Thanks, that's a good point. Honestly, I'm used to styles for headings and the likes but in the text itself I often change formatting for clarity (these are study notes), never really thought to make those into styles, interesting.
Reply With Quote
Reply

Tags
macros



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to change font size Macro to change font size of Footnote Reference in Footnote Text TheBigBoss Word VBA 5 06-10-2022 06:14 AM
Macro to change font size VBA - Word how to globally change the font and font size in footnotes thomasoj Word VBA 3 01-15-2020 06:26 AM
VBA - change font and font size for Word footnote thomasoj Word VBA 1 01-15-2020 02:37 AM
Macro to change font size create macro to change font size to 12.5pt Chuck Barnett Word 5 02-28-2019 07:30 AM
Macro to change font size Looping Macro to Change Font, Font Size, and Give Heading 1 WH7262 Word VBA 1 08-26-2014 03:46 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:57 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft