Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Convert date (2003)

    A colleague has prepared an MS-Word document that includes about 15 tables. The tables have two columns that display (1) the start date and (2) the end date for various courses. The dates appear in civilian format (mm/dd/yy). I need to convert all those dates to standard military format: dd mmm yy. If I were working in Excel or Access, I could probably take care of this myself. In this case, the data is just plain-vanilla text in a simple Word table. Is there any way to convert these dates without re-keying them all (as I did last time)?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Convert date (2003)

    Try this macro:

    Sub ConvertDates()
    Dim oTbl As Table
    Dim oCell As Cell
    Dim strText As String
    Application.ScreenUpdating = False
    For Each oTbl In ActiveDocument.Tables
    oTbl.Select
    For Each oCell In Selection.Cells
    strText = oCell.Range.Text
    strText = Left(strText, Len(strText) - 2)
    If IsDate(strText) Then
    oCell.Range.Text = Format(strText, "dd mmm yy")
    End If
    Next oCell
    Next oTbl
    Application.ScreenUpdating = True
    End Sub

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Convert date (2003)

    M-m-m...sweet! Thank you, Hans!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •