so I started with VBA yesterday and keep running into walls. In the long run, I\'m trying to create a Word template that checks if it\'s still up to date or if it\'s time for re
Your guess about the table cell is correct, but you can work around that by trimming off the extraneous character(s). End-of-cell is a Chr(13) + Chr(7) (Word paragraph plus cell structure marker).
There are various ways to code this, but I have the following function at-hand:
'Your code, relevant lines, slightly altered:
Selection.GoTo what:=wdGoToBookmark, Name:="runningText"
temp = TrimCellText(Selection.Text)
RevisionDate = CDate(temp)
Debug.Print (RevisionDate)
'Function to return string without end-of-cell characters
Function TrimCellText(s As String) As String
Do While Len(s) > 0 And (Right(s, 1) = Chr(13) Or Right(s, 1) = Chr(7))
s = Left(s, Len(s) - 1)
Loop
TrimCellText = s
End Function