none
Using FORMAT on date causes Run-time errot '424': Object required RRS feed

  • Question

  • In the below code DateIn is a string and I am trying to convert it to a date.

    DateOut.Value = Format(DateIn, "dd/mm/yyyy")

    Tuesday, May 21, 2019 8:57 AM

All replies

  • What is the format of the DateIn string expression?  Is DateOut also of text data type?

    Ken Sheridan, Stafford, England

    Tuesday, May 21, 2019 10:18 AM
  • Try with:

    If IsDate(DateIn) Then
        DateOut.Value = Format(DateValue(DateIn), "dd/mm/yyyy")
    Else
        MsgBox "Invalid date: '" & DateIn & "'"
    End If


    Gustav Brock

    Tuesday, May 21, 2019 11:59 AM
  • Try:

    DateOut.Value = Format(CDate(DateIn), "dd/mm/yyyy")

    Tuesday, May 21, 2019 1:25 PM