Date Format Question

S

singeredel

Is there a way to include a non-breaking space between the month and day in
the following date format code so that the month and day do not separate when
they appear at the end of a line?

ScheduleDate1 = Format(ScheduleDate, "mmmm dd, yyyy")

Thanks...
 
G

Greg Maxey

Include the non-breaking character in your format definition:

Sub Test()
Dim SDate As Date
SDate = Now
Selection.Range.InsertAfter _
Format(SDate, "mmmm" & Chr(160) & "dd," & Chr(160) & "yyyy")
End Sub
 
H

Helmut Weber

Hi Singeredel,

looks odd, but seems to work:

Selection.TypeText _
Text:=Format(Now, "mmmm" & Chr(160) & "dd," & Chr(160) & "yyyy")

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
S

singeredel

Thank you both. I didn't realize I could break up the format with the
character code. That works.
 

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

Top