I need a macro for changing font size and a macro for changing the font scale of bullets
Thread poster: Clarisa Moraña
Clarisa Moraña
Clarisa Moraña  Identity Verified
United States
Local time: 15:21
Member (2002)
English to Spanish
+ ...
Mar 26, 2023

Hello!

I need one or two macros to avoid a time consuming manual task:
1) a macro that changes the font size from 11 point to 12 point
Why? The client provides me PDFs that when converted into MS Word include some font styles that automatically change the font size to 11. The files are always the same, and I would like to avoid the process of
Editing > Replace > (Source) Font size (11) > (Target) Font size (12) > Replace all!

2) a macro that change
... See more
Hello!

I need one or two macros to avoid a time consuming manual task:
1) a macro that changes the font size from 11 point to 12 point
Why? The client provides me PDFs that when converted into MS Word include some font styles that automatically change the font size to 11. The files are always the same, and I would like to avoid the process of
Editing > Replace > (Source) Font size (11) > (Target) Font size (12) > Replace all!

2) a macro that changes the font scale of bullets from 138% to 100%
The same PDF files above, when converted, will ALWAYS have the bullets using a font scale of 138%. If I change it into 100% from the List Paragraph style, due to the complicated inner formatting, the file becomes a mess. I don't want to change one by one all the bullets of the file.

I will gladly appreciate your suggestions.

Clarisa
Collapse


 
Andriy Yasharov
Andriy Yasharov  Identity Verified
Ukraine
Local time: 23:21
Member (2008)
English to Russian
+ ...
Possible suggestions Mar 26, 2023

1. Macro to change font size from 11 to 12 point:

Sub ChangeFontSize()
With ActiveDocument.Content.Find
.ClearFormatting
.Font.Size = 11
.Replacement.Font.Size = 12
.Execute Replace:=wdReplaceAll
End With
End Sub

To use this macro, open a Word document and press Alt + F11 to open the Microsoft Visual Basic for Applications window.
Then, go to Insert > Module and paste the code above
... See more
1. Macro to change font size from 11 to 12 point:

Sub ChangeFontSize()
With ActiveDocument.Content.Find
.ClearFormatting
.Font.Size = 11
.Replacement.Font.Size = 12
.Execute Replace:=wdReplaceAll
End With
End Sub

To use this macro, open a Word document and press Alt + F11 to open the Microsoft Visual Basic for Applications window.
Then, go to Insert > Module and paste the code above into the module window. Press F5 or click the Run button to execute the macro.

2. Macro to change bullet font scale from 138% to 100%:

Sub ChangeBulletFontScale()
With ActiveDocument.Styles("List Paragraph").Font
.Scaling = 100
End With
End Sub

To use macro 2, please follow the same steps as for macro 1 and paste the code above into a new module.
Press F5 or click the Run button to execute the macro.
Collapse


Stepan Konev
 
Clarisa Moraña
Clarisa Moraña  Identity Verified
United States
Local time: 15:21
Member (2002)
English to Spanish
+ ...
TOPIC STARTER
Macro 1 works, macro 2 fails Mar 26, 2023

Hi, Andriy

I successfully implemented the first macro, Kudos for you! but the second one is not working. Nevertheless I'm very grateful you helped me. Is it possible to save this macro to use in upcoming files? Or I always need to recreate it? I don't know much about macros.

Thanks

Clarisa


 
Andriy Yasharov
Andriy Yasharov  Identity Verified
Ukraine
Local time: 23:21
Member (2008)
English to Russian
+ ...
Another possible variant Mar 27, 2023

Here's another macro that might help:

Sub ChangeBulletFontScale()
Dim p As Paragraph
For Each p In ActiveDocument.Range.Paragraphs
If p.Range.ListFormat.ListType wdListNoNumbering And p.Range.ListFormat.ListType wdListOutlineNumbering Then
With p.Range.ListFormat.ListTemplate.ListLevels(1).Font
If .Scaling = 138 Then
.Scaling = 100
End If
End With
End If
Next p
End Sub

code

The code gets corrupted when posted, so please use the screenshot above as reference.

This macro loops through all the paragraphs in the document and checks if the paragraph has bullet points. If it does, it then checks if the bullet font scale is set to 138%. If it is, it sets it to 100%. This should ensure that all bullet points in the document have a font scale of 100%.

You can add this macro to your Word document by pressing ALT + F11 to open the VBA editor, then selecting "Insert" from the menu and choosing "Module".

Paste the code above into the new module, then close the VBA editor.
To run the macro, press ALT + F8 to open the "Macro" dialog, select "ChangeBulletFontScale", then click "Run".

It is also possible to save the macro so that one can use it in future files.

Here are the steps to save the macro:

- Open the Word document that contains the macro.

- Press ALT + F11 to open the VBA editor.

- In the VBA editor, select the module that contains the macro.

- Select "File" from the menu, and then select "Export File".

- Choose a location to save the exported file, and then give it a name (e.g., "ChangeBulletFontScale").

- Click "Save".

Now you can use the macro in future Word documents by following these steps:

- Open the Word document where you want to use the macro.

- Press ALT + F11 to open the VBA editor.

- Select "File" from the menu, and then select "Import File".

- Browse to the location where you saved the exported macro file.

- Select the file, and then click "Open".

- Close the VBA editor.

Now the macro should be available in the Word document, and you can run it by pressing ALT + F8 and selecting the macro from the list.

[Edited at 2023-03-27 08:35 GMT]

[Edited at 2023-03-27 08:37 GMT]


 
Andriy Yasharov
Andriy Yasharov  Identity Verified
Ukraine
Local time: 23:21
Member (2008)
English to Russian
+ ...
Macro 2 Mar 27, 2023

Clarisa Moraña wrote:

but the second one is not working.



It's possible that macro 2 won't work in all situations. For example, if your document contains paragraphs with different list styles or if the list formatting has been manually applied to individual paragraphs, this macro may not work as expected.

Another version of macro 2 provided earlier loops through all the paragraphs in the document and checks if they have bullet points.
If a paragraph has bullets, it then checks if the bullet font scale is set to 138%. If it is, it sets it to 100%.
This approach should be more robust and work in a wider range of situations.


Clarisa Moraña
 
Clarisa Moraña
Clarisa Moraña  Identity Verified
United States
Local time: 15:21
Member (2002)
English to Spanish
+ ...
TOPIC STARTER
Thanks! I will try this solution Mar 27, 2023

I will let you know if it worked! For the time being, you saved me half of my wasted time, and that's a lot! I apreciate it!

Thanks

Clarisa


 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

I need a macro for changing font size and a macro for changing the font scale of bullets






CafeTran Espresso
You've never met a CAT tool this clever!

Translate faster & easier, using a sophisticated CAT tool built by a translator / developer. Accept jobs from clients who use Trados, MemoQ, Wordfast & major CAT tools. Download and start using CafeTran Espresso -- for free

Buy now! »
TM-Town
Manage your TMs and Terms ... and boost your translation business

Are you ready for something fresh in the industry? TM-Town is a unique new site for you -- the freelance translator -- to store, manage and share translation memories (TMs) and glossaries...and potentially meet new clients on the basis of your prior work.

More info »