actual time and date

K

kizzie

Hello,

Does anyone know the command for adding the actual time and date to a
string?

thx in advance
 
B

Bob Phillips

If you mean VBA instaed, that is

myVar = "String" & Format(Now,"dd/mm/yyyy hh:mm:ss")
 
D

dominicb

Good morning Kizzie

Do you mean within VBA? The code below will add the time in a
prescribed format to a text string, a.

Sub test()
a = "The time is " & Format(Now(), "hh:mm:ss")
MsgBox a
End Sub

HTH

DominicB
 
Top