J
jpottsx1
My problem is that I want to put in the footer of my page the text
"Report for the week:" and have word insert the result using this week
as the starting point. So I have the calculation working but I cannot
get it to work in the footers. I've tried using a different bookmark
name and putting the bookmark in and running the template but now use.
Any direction on the Header footer issue would be great
Jeff
====================================================
Sub AutoNew()
On Error Resume Next
Selection.GoTo What:=wdGoToBookmark, Name:="wDate"
Selection.InsertBefore Format(WeekStart() - 7, "d/m/yy")
Selection.InsertAfter " to "
Selection.InsertAfter Format(WeekStart(), "d/m/yy")
End Sub
Function WeekStart() As Date
Dim wday As Byte
wday = Weekday(Date)
Select Case wday
Case 1
WeekStart = Date
Case 2
WeekStart = Date - 1
Case 3
WeekStart = Date - 2
Case 4
WeekStart = Date - 3
Case 5
WeekStart = Date - 4
Case 6
WeekStart = Date - 5
Case 7
WeekStart = Date - 6
End Select
End Function
"Report for the week:" and have word insert the result using this week
as the starting point. So I have the calculation working but I cannot
get it to work in the footers. I've tried using a different bookmark
name and putting the bookmark in and running the template but now use.
Any direction on the Header footer issue would be great
Jeff
====================================================
Sub AutoNew()
On Error Resume Next
Selection.GoTo What:=wdGoToBookmark, Name:="wDate"
Selection.InsertBefore Format(WeekStart() - 7, "d/m/yy")
Selection.InsertAfter " to "
Selection.InsertAfter Format(WeekStart(), "d/m/yy")
End Sub
Function WeekStart() As Date
Dim wday As Byte
wday = Weekday(Date)
Select Case wday
Case 1
WeekStart = Date
Case 2
WeekStart = Date - 1
Case 3
WeekStart = Date - 2
Case 4
WeekStart = Date - 3
Case 5
WeekStart = Date - 4
Case 6
WeekStart = Date - 5
Case 7
WeekStart = Date - 6
End Select
End Function