date display from excel in word

  • Thread starter Thread starter [sven]
  • Start date Start date
S

[sven]

Hello all,

I'm working on a macro wich must look for people,dates,currency.. and so on
in a big table, so the selected data are placed in a smaller table, from
wich a word macro (activated by a cmdbutton in excel) uses tha data to make
a mail merge. The selected data is used to write 25-50 letters a time
without having to type :-)

All works well, and as it should, only the date (as in: 12/05/2006) is
displayed as a number ( wich excel uses..) so i don't have date's in my
letters but things as "38849". Not very usefull.. can anybody tell me how
to display the excel date as a date in word ?

I already tried with automated copy-paste, that works, but only very
slowly. I also tried to automate copy and paste in a texbox in excel..that
doesn't work, because i can't paste in a texbox..any ideas ?

tia
sven
 
In either the small or large table, select the cells with the dates in them
and run:

Sub datefixer()
For Each r In Selection
v = Format(DateValue(r.Value), "mm/dd/yyyy")
r.NumberFormat = "@"
r.Value = v
Next
End Sub

This converts the anys into strings with the specified date format. They
should import into Word just fine.
 

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