Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.access
Dale Fye Dale Fye is offline
external usenet poster
 
Posts: 9
Default Add footer to Word doc via Access vba (Word 2007)

I'm trying to add a custom footer to a Word doc that I am creating via Access
vba.

So far, the rest of the application is working great, but now I need to
print a footer with page numbers and date/time at the bottom of each page. I
didn't find any templates that do that when I tried to record a Word macro.

Any ideas would be great.

----
Dale

  #2   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.access
Instructional Designer Instructional Designer is offline
external usenet poster
 
Posts: 1
Default Add footer to Word doc via Access vba (Word 2007)

I'd like to piggyback on your question if you don't mind as my request is
similar.

Along the same lines, would it be possible to populate the footer (or
minimize the footer and just add fields to the bottom of the page) with data
from an Excel file?

I have to update hundreds of long training Word documents each quarter with
very specific/custom data points (page number, course name, section name,
trainer/learner guide, etc.) with very specific formatting.

As it stands, I have to go into each document and update 3-4 fields in the
footer of the first 3 pages (first page is unique, then Even and Odd pages).
It then flows through the rest of the doc but still, it takes several days of
tedious revisions to do this and the chance for error is quite high.

Ideally, I'd like to have a table (Excel or Access) where we can list the
data points and then link the Word doc template to 'lookup' the data.

It would require redoing all of the current docs into the new template but
the time savings would be worth it in the long run.

Thanks in advance.
  #3   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.access
DaveLett DaveLett is offline
external usenet poster
 
Posts: 4
Default Add footer to Word doc via Access vba (Word 2007)

Hi Dale,
Assuming that you have everything else working, I think you can use
something like the following:

Dim oDoc As Document
Dim oRng As Range

Set oDoc = ActiveDocument

Set oRng = oDoc.Sections(1).Footers(wdHeaderFooterPrimary).Ra nge
With oDoc.Fields
.Add Range:=oRng, Type:=wdFieldPage
With oRng
.Collapse direction:=wdCollapseEnd
.InsertBefore Text:=vbTab
.Collapse direction:=wdCollapseEnd
End With
.Add Range:=oRng, Type:=wdFieldDate
End With


Instructional Designer,
Your question is completely different, and I encourage you to start a new
thread. However, based on what you wrote "3-4 fields", I'm inclined to
believe that you shouldn't be accessing the footer object and modifying the
fields directly. Instead, you should _Probably_ be modifying the properties
of the document.
So, to help answer your question, we'll need more details. Are you modifying
the field itself, or are you only updating the field? If you are modifying
the field, why? That is, are you changing the field type? If you're only
updating, how are you storing the values that the fields represent? Are you
using built-in document properties? Custom document properties? Document
variables? Some other method.

Dave



"Dale Fye" wrote:

I'm trying to add a custom footer to a Word doc that I am creating via Access
vba.

So far, the rest of the application is working great, but now I need to
print a footer with page numbers and date/time at the bottom of each page. I
didn't find any templates that do that when I tried to record a Word macro.

Any ideas would be great.

----
Dale

  #4   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.access
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Add footer to Word doc via Access vba (Word 2007)

It might be better to create a template in Word that contains the footer
information that you require and then have your Access code create a new
document from that template using the Documents.Add("TemplateName") command

--
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, originally posted via msnews.microsoft.com
"Dale Fye" wrote in message
...
I'm trying to add a custom footer to a Word doc that I am creating via
Access
vba.

So far, the rest of the application is working great, but now I need to
print a footer with page numbers and date/time at the bottom of each page.
I
didn't find any templates that do that when I tried to record a Word
macro.

Any ideas would be great.

----
Dale


  #5   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.access
Steve[_18_] Steve[_18_] is offline
external usenet poster
 
Posts: 1
Default Add footer to Word doc via Access vba (Word 2007)

Hello Instructional Designer,

I specialize in providing solutions to problems like yours. I provide help
with Access, Excel and Word applications for a very reasonable fee. I would
like to offer to create the solution you need for a nominal fee. I would be
glad to quote you my fee if you contact me.

Steve



"Instructional Designer" Instructional

wrote in message ...
I'd like to piggyback on your question if you don't mind as my request is
similar.

Along the same lines, would it be possible to populate the footer (or
minimize the footer and just add fields to the bottom of the page) with
data
from an Excel file?

I have to update hundreds of long training Word documents each quarter
with
very specific/custom data points (page number, course name, section name,
trainer/learner guide, etc.) with very specific formatting.

As it stands, I have to go into each document and update 3-4 fields in the
footer of the first 3 pages (first page is unique, then Even and Odd
pages).
It then flows through the rest of the doc but still, it takes several days
of
tedious revisions to do this and the chance for error is quite high.

Ideally, I'd like to have a table (Excel or Access) where we can list the
data points and then link the Word doc template to 'lookup' the data.

It would require redoing all of the current docs into the new template but
the time savings would be worth it in the long run.

Thanks in advance.





  #6   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.access
StopThisAdvertising StopThisAdvertising is offline
external usenet poster
 
Posts: 1
Default Add footer to Word doc via Access vba (Word 2007)


"Steve" schreef in bericht
m...
Hello Instructional Designer,

I specialize in providing solutions to problems like yours. I provide help with Access,
Excel and Word applications for a very reasonable fee. I would like to offer to create
the solution you need for a nominal fee. I would be glad to quote you my fee if you
contact me.

Steve



You only specialise in advertising here... other skills of you are limited...

--
Get lost $teve. Go away... far away....

Again... Get lost $teve. Go away... far away....
No-one wants you here... no-one needs you here...

This newsgroup is meant for FREE help..
No-one wants you here... no-one needs you here...
OP look at
http://home.tiscali.nl/arracom/whoissteve.html
(Website has been updated and has a new 'look'... we have passed 10.000 pageloads... it's
a shame !!)

Arno R


  #7   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.access
John... Visio MVP John... Visio MVP is offline
external usenet poster
 
Posts: 33
Default Add footer to Word doc via Access vba - Stevie pimps AGAIN

"Steve" wrote in message
m...
Hello Instructional Designer,

I specialize in providing problems to solutions like yours. I pretend to
provide help with Access, Excel and Word applications for a very
unreasonable fee. I would like to offer to create the solution you need
for a ridiculous fee. I would be glad to con you my fee if you contact me.

Steve




These newsgroups are provided by Microsoft for FREE peer to peer support.
There are many highly qualified individuals who gladly help for free. Stevie
is not one of them, but he is the only one who just does not get the idea of
"FREE" support. He offers questionable results at unreasonable prices. If he
was any good, the "thousands" of people he claims to have helped would be
flooding him with work, but there appears to be a continuous drought and he
needs to constantly grovel for work.

A few gems gleaned from the Word New User newsgroup over the past Christmas
period and a few gems from the Access newsgroups to show Stevie's
"expertise".


Dec 17, 2008 7:47 pm

Word 2007 ..........
In older versions of Word you could highlght some text then go to Format -
Change Case and change the case of the hoghloghted text. Is this still
available in Word 2007? Where?
Thanks! Steve


Dec 22, 2008 8:22 pm

I am designing a series of paystubs for a client. I start in landscape and
draw a table then add columns and rows to setup labels and their
corresponding value. This all works fine. After a landscape version is
completed, I next need to design a portrait version. Rather than strating
from scratch, I'd like to be able to cut and paste from the landscape
version and design the portrait version.
Steve


Dec 24, 2008, 1:12 PM

How do you protect the document for filling in forms?
Steve


One of my favourites:
Dec 30, 2008 8:07 PM - a reply to stevie
(The original poster asked how to sort a list and stevie offered to create
the OP an Access database)

Steve wrote:
Yes, you are right but a database is the correct tool to use not a
spreadsheet.



Not at all. If it's just a simple list then a spreadsheet is perfectly
adequate...


Sept 10, 2009
(In respose to a perfectly adequate GENERIC solution stevie wrote)

This function is specific to the example but not generic for any amount paid
out.

Steve



Sept 9, 2009
"Steve" wrote in message
you can then return all the characters in front of it with the Left()
fumction. Would look like:
Left("YourString",Instr("YourString","VbCr" Or "VbLf") - 1)

Steve


No, it would not look like

Left("YourString",Instr("YourString","VbCr" Or "VbLf") - 1)

First of all, the constants are vbCr and vbLf: no quotes around them. With
the quotes, you're looking for the literal strings.

Second, you can't Or together character constants like that. Even if you
could, Or'ing them together in the InStr function like that makes no sense
at all.



Sept 22,2009
Sorry Steve, even I can see that this is a useless answer. I made it pretty
clear that "CW259" is just ONE possible value for the control.

"Steve" wrote:

Hello David,

Open your report in design view and select txtOrderID. Open properties and
go to the Data tab. Put the following expression in the Control Source
property:

=IIF([chkActive],"CW259","(CW259)")

Steve



John... Visio MVP

  #8   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.access
Dale Fye Dale Fye is offline
external usenet poster
 
Posts: 9
Default Add footer to Word doc via Access vba (Word 2007)

doug,

Unfortunately, my user doesn't want me to deploy a template with the
application, so I'm having to create this from scratch, although the idea of
creating a document template from the application the first time it is run
seems like a reasonable idea. Then I could use that template in the future.

Thanks for the idea.

Dale

"Doug Robbins - Word MVP" wrote in message
...
It might be better to create a template in Word that contains the footer
information that you require and then have your Access code create a new
document from that template using the Documents.Add("TemplateName")
command

--
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, originally posted via msnews.microsoft.com
"Dale Fye" wrote in message
...
I'm trying to add a custom footer to a Word doc that I am creating via
Access
vba.

So far, the rest of the application is working great, but now I need to
print a footer with page numbers and date/time at the bottom of each
page. I
didn't find any templates that do that when I tried to record a Word
macro.

Any ideas would be great.

----
Dale




  #9   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.access
Dale Fye Dale Fye is offline
external usenet poster
 
Posts: 9
Default Add footer to Word doc via Access vba (Word 2007)

Dave,

Thanks, that worked great.

Now, how would I modify that to display the page as "x of y", centered, with
the date/time in the lower right?

Do you have any recommendations for a good reference to the Word Object
model? I've been working in Access for the last 15 years, with an
occassional foray into PowerPoint automation, but am a newbee to Word.

Dale

"DaveLett" wrote in message
...
Hi Dale,
Assuming that you have everything else working, I think you can use
something like the following:

Dim oDoc As Document
Dim oRng As Range

Set oDoc = ActiveDocument

Set oRng = oDoc.Sections(1).Footers(wdHeaderFooterPrimary).Ra nge
With oDoc.Fields
.Add Range:=oRng, Type:=wdFieldPage
With oRng
.Collapse direction:=wdCollapseEnd
.InsertBefore Text:=vbTab
.Collapse direction:=wdCollapseEnd
End With
.Add Range:=oRng, Type:=wdFieldDate
End With


Instructional Designer,
Your question is completely different, and I encourage you to start a new
thread. However, based on what you wrote "3-4 fields", I'm inclined to
believe that you shouldn't be accessing the footer object and modifying
the
fields directly. Instead, you should _Probably_ be modifying the
properties
of the document.
So, to help answer your question, we'll need more details. Are you
modifying
the field itself, or are you only updating the field? If you are modifying
the field, why? That is, are you changing the field type? If you're only
updating, how are you storing the values that the fields represent? Are
you
using built-in document properties? Custom document properties? Document
variables? Some other method.

Dave



"Dale Fye" wrote:

I'm trying to add a custom footer to a Word doc that I am creating via
Access
vba.

So far, the rest of the application is working great, but now I need to
print a footer with page numbers and date/time at the bottom of each
page. I
didn't find any templates that do that when I tried to record a Word
macro.

Any ideas would be great.

----
Dale



  #10   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.access
DaveLett DaveLett is offline
external usenet poster
 
Posts: 4
Default Add footer to Word doc via Access vba (Word 2007)

Hi Dale,
By no means is this an elegant solution, but it works in my environment:

Dim oDoc As Document
Dim oRng As Range

Set oDoc = ActiveDocument

Set oRng = oDoc.Sections(1).Footers(wdHeaderFooterPrimary).Ra nge
With oDoc.Fields
.Add Range:=oRng, Type:=wdFieldPage
With oRng
.InsertBefore Text:="Page "
.Collapse direction:=wdCollapseEnd
.InsertAfter Text:=" of "
.Paragraphs(1).Alignment = wdAlignParagraphRight
.Collapse direction:=wdCollapseEnd
End With
.Add Range:=oRng, Type:=wdFieldNumPages
With oRng
.Start = .Paragraphs(1).Range.End
.End = .Paragraphs(1).Range.End
.InsertParagraphAfter
.Collapse direction:=wdCollapseEnd
End With
.Add Range:=oRng, Type:=wdFieldDate
End With

As for Word resources: 1) this forum is great, 2) I routinely hit this URL
(http://word.mvps.org/FAQs/MacrosVBA/index.htm), and 3) the help in Word VBA
is pretty good (IMHO).

Dave


  #11   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general,microsoft.public.access
Dale Fye Dale Fye is offline
external usenet poster
 
Posts: 9
Default Add footer to Word doc via Access vba (Word 2007)

Dave,

Close, but not quite there yet.

I want the page numbers centered on the page, on the same line as the date,
which will be aligned right. I managed to get the entire thing on the same
line, with Page x of y centerd on the page, but still have not figured out
how to get the date to line up at the far right margin of the page. I assume
that I probably need to do something like the .Start/.End/ and alignment
thingy that is in the second oRng With/EndWith block, but cannot for the
life of me figure this out.

Set oRng = wdDoc.Sections(1).Footers(wdHeaderFooterPrimary).R ange
With wdDoc.Fields
.Add Range:=oRng, Type:=wdFieldPage
With oRng
.InsertBefore Text:="Page "
.Collapse Direction:=wdCollapseEnd
.InsertAfter Text:=" of "
.Collapse Direction:=wdCollapseEnd
End With
.Add Range:=oRng, Type:=wdFieldNumPages
With oRng
.Start = .Paragraphs(1).Range.End
.End = .Paragraphs(1).Range.End
.Paragraphs(1).Alignment = 1 'wdAlignParagraphCenter
End With
.Add Range:=oRng, Type:=wdFieldDate
With oRng
.InsertBefore Text:=" "
.Collapse Direction:=wdCollapseEnd
End With
End With

Your help so far has been right on. If we can just tackle this last little
bit, my boss will be ecstatic.

Dale

"DaveLett" wrote in message
...
Hi Dale,
By no means is this an elegant solution, but it works in my environment:

Dim oDoc As Document
Dim oRng As Range

Set oDoc = ActiveDocument

Set oRng = oDoc.Sections(1).Footers(wdHeaderFooterPrimary).Ra nge
With oDoc.Fields
.Add Range:=oRng, Type:=wdFieldPage
With oRng
.InsertBefore Text:="Page "
.Collapse direction:=wdCollapseEnd
.InsertAfter Text:=" of "
.Paragraphs(1).Alignment = wdAlignParagraphRight
.Collapse direction:=wdCollapseEnd
End With
.Add Range:=oRng, Type:=wdFieldNumPages
With oRng
.Start = .Paragraphs(1).Range.End
.End = .Paragraphs(1).Range.End
.InsertParagraphAfter
.Collapse direction:=wdCollapseEnd
End With
.Add Range:=oRng, Type:=wdFieldDate
End With

As for Word resources: 1) this forum is great, 2) I routinely hit this URL
(http://word.mvps.org/FAQs/MacrosVBA/index.htm), and 3) the help in Word
VBA
is pretty good (IMHO).

Dave



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2007 mailmerge from Access 2007 [email protected] Mailmerge 3 March 19th 09 10:40 PM
Word 2007 mailmerge from Access 2007 jim Mailmerge 3 September 17th 08 05:39 PM
Mailmerge from Access 2007 to Word 2007 .docx document Russell Profitt[_3_] Mailmerge 0 March 20th 08 12:16 PM
Word 2007 Mailmerge with Access 2007 using DDE Russell Profitt Mailmerge 0 March 14th 08 01:11 PM
insert Access 2007 database table into a Word 2007 doc and print Leedell Microsoft Word Help 0 October 20th 07 08:10 AM


All times are GMT +1. The time now is 03:45 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"