Click here to Skip to main content
15,118,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Expert,
I have to develope a macro in VBA which should be run when the ms word start, and when new document created or open any existing document. My problem is am not able to place the macro at correct position.
I want to write a macro which will make the font "Arial" default when document will be open or created. I know this facility already given by microsoft but i need to do this for our clients.
Kindly help me.
Regards
Posted

Hi,

As per my Knowledge you need save the document as Macro enabled word document extension. ( I am using word 2010 so .docm). Press Alt+F11 to navigate to code window then try this below code Save the document. This will help you I think.

Sub activeMacro()
Selection.Font.Name = "Arial"
Selection.Font.Size = 16
End Sub

Thanks.
Sriram.B
   
Comments
Maciej Los 14-Aug-13 3:49am
   
A4!
I prefer to replace "normal template" than using macro. Please, see my answer.
You don't need any code. Create new Normal Template document and send it to your client.
A Template is a document type that creates a copy of itself when you open it. A Normal template opens whenever you start Word, and it includes default styles, AutoText, macros, toolbars, and other customizations that determine the basic look of your document.

Change the Normal template (Normal.dot) [^]
Change the Normal template (Normal.dotm )[^]
Save a Word document as a template[^]

Using macros to set default font is a... bad idea ;(
   
Comments
R. S. Verma 14-Aug-13 4:48am
   
A very great ful thanks but I have doublt about this solution as if clients have his own setting in his Normal template then in that case might be problem may occure.
but ur suggestion really helpfull
thanks a lot...
Maciej Los 14-Aug-13 5:08am
   
You're welcome ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900