change entered information to time

G

Guest

I think this is simple but for the life of me i cannot find what i'm looking
for, I am trying to make a templet for phone messages. I have a Time field
with text box and a date field with text box. I do not need the current time
entered in the time box usually, I want to know how to make it so that if i
type 1245 it will auto change to 12:45 and a date to go from 081807 to auto
format to 8/18/07 and if you want to get even further with it i have a notes
text box that i need to have several lines on but when i type into the box it
does not go to the next line... i'm a beginner with this any help will be
most appreciated
Thanks!
 
G

Guest

Ok, dont really know how i did it but i got the text to wrap correctly in
the text box. so only thing left is the date/time issue. Thanks all!
 
G

Graham Mayor

It would make more sense (if I understand your requirement correctly) to
insert the current time and or date in the document with a macro. You can
then format it any way you want. Word does not take numbers and format them
into dates automatically.

eg

Sub InsertMsgTime()
With Selection
.InsertDateTime DateTimeFormat:="hh:mm", InsertAsField:=False
End With
End Sub

will insert the current time (as text)

Sub InsertUSFormatDate()
With Selection
.InsertDateTime DateTimeFormat:="MM/dd/yyyy", InsertAsField:=False
End With
End Sub

will insert the current date (as text) of combine them

..InsertDateTime DateTimeFormat:="dd/MM/yy hh:mm", InsertAsField:=False

http://www.gmayor.com/installing_macro.htm

The alternative is to use a protected form with date fields (not with the
current data or time set). You need to fill the fields with the current time
and date so they remain editable. You do this by saving the locked form as a
template and creating new documents from it. Assuming that the date goes in
field Text1 and the time in field Text2, add the following macro to the form
template:

Sub AutoNew()
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
oFld("Text1").Result = Format(Date, "MM/dd/yy")
oFld("Text2").Result = Format(Time, "HH,mm")
oFld("Text1").Select
End Sub

Don't use text boxes for the body text. Either type in the body of the
document, of in the case of a form, insert a text form field. If you need it
in a box, use a table cell.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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