Macro

T

TOMMIETOM

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
 
D

Doug Robbins - Word MVP

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.

--
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
 
J

Jezebel

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?
 
T

TOMMIETOM

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
 
J

Jezebel

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top