View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default MsgBox date & time

I was going to make that point, but in fairness to Steve, his example
include a line-break between (as did the one he was commenting on) between
the date and time, whereas yours does not.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Charlie" wrote in message
...
Well, if you want to discuss not getting overly complicated why not just

MsgBox Now

Or

MsgBox Date & " " & Time

(and the parentheses are not required either)


"Steve Schroeder" wrote:

May I interject?

This example, with all apologies is bad form.

The 'corrected' version of this would be:

Sub MsgDateDate()
Dim BoxDate As String
Dim BoxTime As String
Dim BoxText As String

BoxDate = Date
BoxTime = Time
BoxText = BoxDate & vbCrLf & BoxTime

MsgBox BoxText

End Sub

Or just very simply:

MsgBox(Date & vbCRLF & Time)

No need to get overly complicated.


"Neil" wrote in message
...
Skippy,

The following bit of code should do what you want, if you don't want

it on
two lines, just remove the CHR(13) part from the formula.

Boxdate = Date
Boxtime = Time()
boxtext = Boxdate & Chr(13) & Boxtime
MsgBox (boxtext)

HTH

Neil
www.nwarwick.co.uk

"skippy" wrote:

am learning VB / Macros ... need a MsgBox which contains both the

current
date and time ... I am able to do one or the other, but not both ...

what is
the syntax?

e.g. I was able to figure out MsgBox (Time) and MsgBox

(Date)
but can not figure out how to get BOTH in the MsgBox