How to write current time to the cell?

  • Thread starter Thread starter Jack
  • Start date Start date
J

Jack

When I do:
If oExLogCallTime <> 0 Then moExcelWS.Cells(CurrentRow,
oExLogCallTime).Value = Time
or
If oExLogCallTime <> 0 Then moExcelWS.Cells(CurrentRow,
oExLogCallTime).Value = CStr(Time)

each time when Time is written into sheet the cell displays ##### instead
of digits.
Of course when I resize column the digits appear correctly.

I have noticed that when data written is plain text Excel never displays
#### even if the text is longer then the column width.

My question is how to write that Time so it will be treated as a text?
Jack
 
If oExLogCallTime <> 0 Then
with moExcelWS.Cells(CurrentRow, oExLogCallTime)
.numberformat="@" 'text
.Value = format(time,"hh:mm:ss")
end with
....

or
.value = "'" & format(time,"hh:mm:ss")
 

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

Back
Top