PDA

View Full Version : VBA in Word Question


bdawg737
05-19-04, 14:46
I know there has got to be a way for me to programatically add a file (another word document) with the click of a button I place in a toolbar. The file must go in the header/footer section. Anyone know how to do this?? Thanks so much

Kodo
05-19-04, 15:13
VBA for word isn't my strong point so maybe this will point you in the right direction..

make a new module for Normal.dot and call it FileIns

make a new sub in the module:

Sub DoFileInert()

selection.insertfile "C:\pathtofile\filename.doc"

end sub

now make a too tool bar button and drag the module onto the button from the macro's menu

That will insert a file at the click of a button. Hope it gets you pointed in the right direction.

bdawg737
05-19-04, 15:19
Thanks for that info. Do you (or anyone else out there for that matter) know how to put it inside the header? I suspect I've got to call some header/page interface but cant seem to figure out how to do it. thanks again

Maxwell
05-19-04, 17:09
You may find it easier to record the macro using this feature within MS Word and assign this to your button.

With regard to Header/Footer this is toggled under the View menu. What I usually do is to record a macro but using only keyboard shortcuts, which you can find in the MS Word on-line help.