Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

autotext in headerfooter – VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sugarboyrosnerd - 15 Sep 2006 17:54 GMT
Using: Word 2000

This is my first post, but I've been reading your pages all year and find
them enormously useful. I am a beginning VBA programmer.

I am creating a suite of automated templates for my company. I have a macro
that deletes all content within all headers and footers in the active
document.

Now I want to create a macro that inserts autotext into all headers and
footers. The autotext is a series of docvariable fields stored in a global
template. I don't know where to begin. Could you please help?

best wishes from Western Canada,
sugarboyrosnerd
Doug Robbins - Word MVP - 15 Sep 2006 18:40 GMT
I would recommend that you do not use VBA to set up the headers and footers
in documents created from templates.  It is much easier to just create the
template with the headers and footers already in them.

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

> Using: Word 2000
>
[quoted text clipped - 12 lines]
> best wishes from Western Canada,
> sugarboyrosnerd
sugarboyrosnerd - 18 Sep 2006 15:59 GMT
I agree Doug. In fact, my templates already contain the required header and
footer fields, as you recommended in your last post.
Perhaps I should explain why I want to create a macro that will insert
autotext in headers and footers. I'm concerned that users will delete
existing header/footer docvariable fields, which will generate an error
whenever the user tries to update the docvariable fields.
My logic is this – by deleting all header and footer content and then
replacing all header and footer content with autotext (that contains
docvariable fields),  I'll have a quick and automatic way to correct all
headers and footers – no matter how badly the user messes up the
header/footer content.
Does this make sense to you?
Thank you for your time and advice.
best wishes from Western Canada,
sugarboyrosnerd

> I would recommend that you do not use VBA to set up the headers and footers
> in documents created from templates.  It is much easier to just create the
[quoted text clipped - 16 lines]
> > best wishes from Western Canada,
> > sugarboyrosnerd
Doug Robbins - Word MVP - 18 Sep 2006 19:03 GMT
While the deletion of Docvariable field will result in the desired result
not being achieved, it should not cause any error message to appear.

Maybe more appropriate for you to see the article "How can I prevent users
from editing the header of a document in Word 2000 or higher?" at:

http://www.word.mvps.org/FAQs/Customization/ProtectWord2000PlusHeader.htm

or, "How can I prevent users from editing the header of a Word 97 document?"
at:

http://www.word.mvps.org/FAQs/Customization/ProtectWord97Header.htm

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

>I agree Doug. In fact, my templates already contain the required header and
> footer fields, as you recommended in your last post.
[quoted text clipped - 36 lines]
>> > best wishes from Western Canada,
>> > sugarboyrosnerd
sugarboyrosnerd - 18 Sep 2006 20:40 GMT
Absolutely spectacular Doug! I didn't think this was even possible.
This works and is a far better solution than the one I proposed.
Thank you, thank you, thank you.

best wishes from Western Canada,
sugarboyrosnerd

> While the deletion of Docvariable field will result in the desired result
> not being achieved, it should not cause any error message to appear.
[quoted text clipped - 49 lines]
> >> > best wishes from Western Canada,
> >> > sugarboyrosnerd
Russ - 07 Oct 2006 21:48 GMT
Sugarboyrosnerd,
> Using: Word 2000
>
> This is my first post, but I've been reading your pages all year and find
> them enormously useful. I am a beginning VBA programmer.
Microsoft.public.word.vba.beginners

> I am creating a suite of automated templates for my company. I have a macro
> that deletes all content within all headers and footers in the active
[quoted text clipped - 3 lines]
> footers. The autotext is a series of docvariable fields stored in a global
> template. I don't know where to begin. Could you please help?
Have you tried recording a macro while manually going through the operations
required? Then look at the code produced. That's where you can begin.
Afterwards, if you have more specific questions, you can ask in another
message thread.

> best wishes from Western Canada,
> sugarboyrosnerd

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.