View Full Version : Word Macros?

01-30-2005, 10:02 AM
I'm trying to create a Macro that does the headers of my documents... what i want it to do is.. basically just name, date, and (class/teacher)
Basic Structure of the Macro

(Justify accordingly)


- The name is always the same.. so that part should be easy..
- Now the date.. is there a way of making a macro that would look at the current date at that time and insert it in a certain format?..
-Then maybe it could try to insert the teachers/class name.. but this would need to be done by me.. i know this is lazy but is there a way of having the macro prompt me for w/e I want to insert for this "field"?
- Afterwards.. move on and do something else?


02-06-2005, 05:53 AM

02-08-2005, 11:42 AM
Right then, i don't usually do this for people :) but today i'll make an exception.

Now you can record a macro which sorts the insert date into a header as normal.

Just go to record macro, while it's recording go view Header's and Footers, then while you're in the header go to insert and click date. Follow choose what date format you want. You should be able to record typing in that name if it stays the same. Then click stop :)

now the fun part..

You can sort the text prompt out for the teacher name, by adding this to the macro using the VB editor.

teach_name = InputBox("Enter Name here")
Selection.TypeText (" " + teach_name)

The first line is just the box you get to input the name. The second line puts spaces in and then the name.

If you want to read up more just hit this place:

MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbawd11/html/wohowDisplayBuiltInDialogs1_HV05210531.asp)

That should sort you out,