Hello,
Thank you for reading my post. I know time is valuable thing when it comes to programing. I am not an expert but I know a bit about programming and currently stuck in a situation. I am trying to auto-increment date in header of Microsoft Word 2010 document for about 100 pages, pages could be less. Example:
Page1 Header: Sunday, May 4th 2014
Page2 Header: Monday, May 5th 2014
Page3 Header: Tuesday, May 6th 2014 etc. until given page.
The reason I want to put this date in the header section of a document, because this date is repeating. Also, if there is another way to place it automatically into every page with VB, that is also a solution for me.
Here is what I have for code:
CODE -->
This code works but it does not auto-increment the date. From code you can see that I am not an expert. However, if you can help me in a way that I can use your solution I will reward you, if you have pay-pal account.
Thank you.
Thank you for reading my post. I know time is valuable thing when it comes to programing. I am not an expert but I know a bit about programming and currently stuck in a situation. I am trying to auto-increment date in header of Microsoft Word 2010 document for about 100 pages, pages could be less. Example:
Page1 Header: Sunday, May 4th 2014
Page2 Header: Monday, May 5th 2014
Page3 Header: Tuesday, May 6th 2014 etc. until given page.
The reason I want to put this date in the header section of a document, because this date is repeating. Also, if there is another way to place it automatically into every page with VB, that is also a solution for me.
Here is what I have for code:
CODE -->
Code:
Sub EditHeadersAndFooters()
Dim i As Long
Dim mBefore As Date
For i = 1 To ActiveDocument.Sections.Count
With ActiveDocument.Sections(i)
mBefore = Format(DateAdd("d", i, Date), "dd mmmm yyyy")
.Headers(wdHeaderFooterPrimary).Range.Text = mBefore
.Footers(wdHeaderFooterPrimary).Range.Text = foo
End With
Next
End Sub
This code works but it does not auto-increment the date. From code you can see that I am not an expert. However, if you can help me in a way that I can use your solution I will reward you, if you have pay-pal account.
Thank you.