Date Calculation from form field

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top