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 United States Local time: 09:33 Member (2002) English to Spanish + ...
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 Ukraine Local time: 17:33 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 | | | Clarisa Moraña United States Local time: 09:33 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 Ukraine Local time: 17:33 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
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 Ukraine Local time: 17:33 Member (2008) English to Russian + ...
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 United States Local time: 09:33 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 Trados Business Manager Lite | Create customer quotes and invoices from within Trados Studio
Trados Business Manager Lite helps to simplify and speed up some of the daily tasks, such as invoicing and reporting, associated with running your freelance translation business.
More info » |
| Trados Studio 2022 Freelance | The leading translation software used by over 270,000 translators.
Designed with your feedback in mind, Trados Studio 2022 delivers an unrivalled, powerful desktop
and cloud solution, empowering you to work in the most efficient and cost-effective way.
More info » |
|
| | | | X Sign in to your ProZ.com account... | | | | | |