Dear,
Is it possible te create a macro in Word, that is registered in word itselfs
and not in a document, so the macro kan run on differt docs in word ?
I want to create a macro that inserts automatically a border
Page setup - layout - border
I also want te insert automaticallyu header and foodnote.
Is this possible ?
Thanks in advance !
Tom
Doug Robbins - Word MVP - 05 Mar 2007 12:06 GMT
If you need a macro that is available for use with all documents, you should
create the macro in a template and save that template in the Word\Startup
folder. You can determine the location of that folder under
Tools>Options>File Locations.
However, rather than creating a macro that inserts borders/headers/footers,
you should create a template that includes those features and save it in
your User Templates folder and then when you want a document that contains
those features, create a document from that template by selecting New from
the File menu and then select the template as the basis for the document
that you want to create.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Dear,
>
[quoted text clipped - 7 lines]
> Thanks in advance !
> Tom
Jezebel - 05 Mar 2007 12:42 GMT
Not really sure what you're asking. Macros normally go in templates, not
documents; and they don't need registering. Yes it's possible to write a
macro that inserts headers and footers, but it's usually simpler to
predefine them in a template -- then you don't need code at all. What are
you trying to do?
> Dear,
>
[quoted text clipped - 7 lines]
> Thanks in advance !
> Tom
TOMMIETOM - 06 Mar 2007 10:21 GMT
I have a macro made in Excel that opens word en paste a (large) amount of
text in a new word doc.
So I have a Word doc and now I want to add in a simple way header and footer
and a border.
In the macro in excel I don't think I can open a template in word, so I want
in word a possibility to create automaticaly a border and heater and footer.
Doug wrote taht is possible to create a macro in a template and save that
template in the Word\Startup folder.
In excel I can easilly 'record" a macro and than edit it.
How does it works in Word ?
Thanks in advance !
Tom
> Not really sure what you're asking. Macros normally go in templates, not
> documents; and they don't need registering. Yes it's possible to write a
[quoted text clipped - 13 lines]
> > Thanks in advance !
> > Tom
Jezebel - 06 Mar 2007 13:30 GMT
No problem about using a template when you create the document in Excel.
Your code should be something like --
Dim pDoc as Word.Document
Const pTEMPLATE as string = "C:\....\MyReport.dot"
set pDoc = [WordApp].Documents.Add(Template:=pTEMPLATE)
The Word macro recorder is at Tools > Macro.
>I have a macro made in Excel that opens word en paste a (large) amount of
> text in a new word doc.
[quoted text clipped - 32 lines]
>> > Thanks in advance !
>> > Tom