definition for the RUN_DATE column; has to be a DATETIME (it only needs to be a DATE, but corporate policy...) So when it gets into the spreadsheet, Excel stores it as a number. Here's my work-around:
'--- Run Date column
For j = 2 To intRowsOfData + 1
If TypeOf excelSheet.Cells(j, 4).Value Is System.Double Then
myDate = DateAdd(DateInterval.Day, Convert.ToDouble(excelSheet.Cells(j, 4).Value), StartDate)
' for some weird unknown reason, the previous statement produces a date
' 2 days greater than the actual date value
myDate = DateAdd(DateInterval.Day, -2, myDate)
excelSheet.Cells(j, 4).NumberFormat = "@"
excelSheet.Cells(j, 4).Value = FormatCellDisplayDate(myDate)
Else
excelSheet.Cells(j, 4).Value = FormatCellDisplayDate(Today)
End If
Next
Private Function FormatCellDisplayDate(ByVal inDate As Date) As String
Dim strBuf As String
strBuf = Format(inDate, "MM/dd/yyyy")
Return strBuf
End Function
'--- Run Date column
For j = 2 To intRowsOfData + 1
If TypeOf excelSheet.Cells(j, 4).Value Is System.Double Then
myDate = DateAdd(DateInterval.Day, Convert.ToDouble(excelSheet.Cells(j, 4).Value), StartDate)
' for some weird unknown reason, the previous statement produces a date
' 2 days greater than the actual date value
myDate = DateAdd(DateInterval.Day, -2, myDate)
excelSheet.Cells(j, 4).NumberFormat = "@"
excelSheet.Cells(j, 4).Value = FormatCellDisplayDate(myDate)
Else
excelSheet.Cells(j, 4).Value = FormatCellDisplayDate(Today)
End If
Next
Private Function FormatCellDisplayDate(ByVal inDate As Date) As String
Dim strBuf As String
strBuf = Format(inDate, "MM/dd/yyyy")
Return strBuf
End Function