K
Keith
I am a bit rusty, but here the situation. I have a word 2000 document that
has a form field with the bookmark MotionDate that the user will enter a
date. in the format of M/d/yy. I have another form field bookmarked
ResponseDate, that I need to calculate a date of MotionDate + X amount of
days, on the entry of the form field. I tried the code listed below, but I
am getting the error msg "Run Time Error 13" , "Type Mismatch".
Sub ResponseDtCalc()
'
' ResponseDtCalc Macro
' Macro created 4/21/2008 by huntkl
'
Dim oRng As Range
Dim motiondt As Date
Dim responsedt As Date
motiondt = CDate(ActiveDocument.Bookmarks("MotionsDate").Range.Text)
responsedt = DateAdd("d", 21, motiondt)
Select Case Format(responsedt, "DDDD")
Case "Saturday"
responsedt = DateAdd("d", 2, responsedt)
Case "Sunday"
responsedt = DateAdd("d", 1, responsedt)
Case Else
'Do Nothing
End Select
Set oRng = ActiveDocument.Bookmarks("DD)").Range
oRng.Text = responsedt
ActiveDocument.Bookmarks.Add "DD", oRng
End Sub
Any suggestions greatly appreciated.
has a form field with the bookmark MotionDate that the user will enter a
date. in the format of M/d/yy. I have another form field bookmarked
ResponseDate, that I need to calculate a date of MotionDate + X amount of
days, on the entry of the form field. I tried the code listed below, but I
am getting the error msg "Run Time Error 13" , "Type Mismatch".
Sub ResponseDtCalc()
'
' ResponseDtCalc Macro
' Macro created 4/21/2008 by huntkl
'
Dim oRng As Range
Dim motiondt As Date
Dim responsedt As Date
motiondt = CDate(ActiveDocument.Bookmarks("MotionsDate").Range.Text)
responsedt = DateAdd("d", 21, motiondt)
Select Case Format(responsedt, "DDDD")
Case "Saturday"
responsedt = DateAdd("d", 2, responsedt)
Case "Sunday"
responsedt = DateAdd("d", 1, responsedt)
Case Else
'Do Nothing
End Select
Set oRng = ActiveDocument.Bookmarks("DD)").Range
oRng.Text = responsedt
ActiveDocument.Bookmarks.Add "DD", oRng
End Sub
Any suggestions greatly appreciated.