word vba macro

Forum home » Delegate support and help forum » Microsoft VBA Training and help » WORD VBA MACRO

WORD VBA MACRO

resolvedResolved · Medium Priority · Version 2010

Stephen has attended:
Excel VBA Intro Intermediate course

WORD VBA MACRO

Hi There

You helped me with a vba macro for mail merge splitter very successfully.

All was going fine until one of the secretaries noticed that the font would change once the splitter did its job although the default style setting for WORD is the same.

For example: Word font is set as default to TREBUCHET MS size 10. Once the mail merge has split the document, the font changes to Calibri 11

Can you help with an answer for this as i am stumped as to why it would do this...... ANY code that you may have would be helpful for me to test out

Thanks

Steve

RE: WORD VBA MACRO

Hi Stephen

Thanks for getting in touch. I remember that mail merge!

Calibri 11 is the default sizing in Word 2010 (Word calls this "Normal").

I am guessing that the documents created (because it creates new documents for each letter) use the Normal template and use that style.

You could either modify the Normal template (go into the font settings and Set As Default) or add a line of code that formats the documents afterwards. You could record a further macro to get the code.

I hope this helps.

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: WORD VBA MACRO

Thanks Gary

The only issue i have is that each of the secretaries will change the font size, e.g. one will use size 10 and another may use size 12, but i think the font will remain the same

S

RE: WORD VBA MACRO

Hi Stephen

It sounds like it would suit you better to format the documents after splitting. You could get the formatting of the secretary's current paragraph (for example) and then apply it to the output, looping through each of the documents in the folder.

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: WORD VBA MACRO

Thanks again. I get the idea, but dont know how to go about it if i'm honest!!!

can you point me in the right direction?

S

RE: WORD VBA MACRO

Hi Stephen

It's getting a bit in-depth for this forum to provide a complete answer, but this link describes merging documents from one folder into one file. While it's not what you want to do you will get the components of iterating through a collection of documents.

http://www.extendoffice.com/documents/word/969-word-merge-multiple-documents.html #a2

Furthermore this link explores "PasteAndFormat" which might give you another clue:

http://stackoverflow.com/questions/14316916/copy-text-from-table-in-word-and-retaing-formatting

I hope this helps.

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: WORD VBA MACRO

Thanks Gary for all your help. I will give it a go...

S

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

VBA tip:

Suspend DisplayAlerts in VBA

To stop Excel asking you things like "Do you want to delete this file...", use the following line of code at the beginning of the relevant VBA procedure:

Application.DisplayAlerts = False

At the end of the procedure make sure you use the following code to reactivate Display Alerts:

Application.DisplayAlerts = True

View all VBA hints and tips


Server loaded in 0.1 secs.