Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-27-2019, 03:19 PM
dita dita is offline Global value for Font.Size? Windows XP Global value for Font.Size? Office 2010 64bit
Advanced Beginner
Global value for Font.Size?
 
Join Date: Apr 2018
Posts: 34
dita is on a distinguished road
Default Global value for Font.Size?

Hello,




I´m looking for a macro that keeps the same size of the fonts when I change the formats of bidirectional languages.


However, I don´t know how to keep the same font size whatever the font size is in the document.


In other words, if the font size is 7 in the latin text, I want 7 in the bidirectional document too. If it is 8, I want it 8 too.


So, instead of giving a value to all fonts individually in the document (7, 8, ...), I want range or global value to keep the same font size.


At the moment, I have created this macro. As you can see, I have duplicated the code to keep the font size to 7 and another one to keep the font size 8.


However, I´m looking for a global value or a range to apply to Font.Size = "" that keeps the same font size, without the need of inserting 7, 8, etc..


Does anyone know if this is possible?


Sub ReplaceFontForOneDocument()
Dim objSingleWord As Range
Dim objDoc As Document


Set objDoc = ActiveDocument

With objDoc
For Each objSingleWord In .Words
If objSingleWord.Font.Size = "7" Then
objSingleWord.Font.SizeBi = "7"
End If
Next
End With

With objDoc
For Each objSingleWord In .Words
If objSingleWord.Font.Size = "8" Then
objSingleWord.Font.SizeBi = "8"
End If
Next
End With
Reply With Quote
  #2  
Old 06-27-2019, 08:40 PM
Guessed's Avatar
Guessed Guessed is offline Global value for Font.Size? Windows 10 Global value for Font.Size? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Doing this for every word is ultra-slow but the basic principle would be
Code:
Sub ReplaceFontForOneDocument()
Dim objSingleWord As Range
For Each objSingleWord In ActiveDocument.Words
  objSingleWord.Font.SizeBi = objSingleWord.Font.Size
Next
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Global value for Font.Size? Merging two Word documents: 2nd document not maintaining original font type and font size Swarup Word 31 08-28-2018 06:55 PM
Global formatting and changing title font George Tang OneNote 0 02-05-2016 06:55 PM
Font size showing different (some superscripted??) but tools show its the same size? mikkygee PowerPoint 4 12-14-2015 11:21 PM
Global value for Font.Size? Looping Macro to Change Font, Font Size, and Give Heading 1 WH7262 Word VBA 1 08-26-2014 03:46 PM
Cursor size varies with font size r_lewis@fuse.net Word 0 07-20-2011 06:11 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:24 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