A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Fields Are Not formatting



 
 
Thread Tools Display Modes
  #1  
Old May 26th, 2009, 02:42 AM
MaxArk MaxArk is offline
Experienced Member
 
First recorded activity by OfficeFrustration: Mar 2008
Posts: 35
Default Fields Are Not formatting

I have an Excel database that I am using as my source data.
I have columns in this worksheet representing dates and times, and are formatted accordingly.

However, when these values are used in my merge document, they do not take on the proper formatting despite my forced document formatting code.

ie {MERGEFIELD "Date" \@ "dd-MMM-yy" } is showing the result as a serial number 39959 instead of 26-May-09

{MERGEFIELD ""F13" \@ ”h:mm AM/PM"} is showing 0.64583333333 rather than 3:30 PM

Can anyone help me with getting the proper formatting of my fields?

Jenn
  #2  
Old May 26th, 2009, 09:06 AM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Fields Are Not formatting

Typically this problem is actually to do with the way that Word gets the
data from Excel - see http://tips.pjmsn.me.uk/t0003.htm for an
explanation and some suggestions.

In addition to that, macropod has suggested previously that it would be
possible to reconstruct the date from an Excel serial number using his
"date field calculation" approach, which you can find at

http://www.wopr.com/index.php?showto...#entry249 902

I advise you to read the introduction. There is, or was, a section titled

IMPORTING DATE AND TIME VALUES FROM EXCEL AND ACCESS

which may provide the basis for what you need.

For the times,

I think

{ QUOTE "{ SET T { MERGEFIELD F13 } }{ =T*24 \#00 }:{
=((T*24)-INT(T*24))*60 \#00 }" \@"h:mm AM/PM" }

will do it, but again, I am sure you will find more reliable and/or
flexible calculations in macropod's document. All the {} need to be the
special "field code braces" that you can insert using ctrl-F9.

Personally I would normally favour the idea of "getting the data source
right" but the current methods for getting data from Excel do not make
that at all straightforward.


Peter Jamieson

http://tips.pjmsn.me.uk

MaxArk wrote:
I have an Excel database that I am using as my source data.
I have columns in this worksheet representing dates and times, and are
formatted accordingly.

However, when these values are used in my merge document, they do not
take on the proper formatting despite my forced document formatting
code.

ie {MERGEFIELD "Date" \@ "dd-MMM-yy" } is showing the result as a
serial number 39959 instead of 26-May-09

{MERGEFIELD ""F13" \@ ”h:mm AM/PM"} is showing 0.64583333333 rather
than 3:30 PM

Can anyone help me with getting the proper formatting of my fields?

Jenn




  #3  
Old May 26th, 2009, 07:14 PM
MaxArk MaxArk is offline
Experienced Member
 
First recorded activity by OfficeFrustration: Mar 2008
Posts: 35
Default

Augh!! Couldn't be any easier. LOL

I had a similar application (mail merge report) that took similar data from an Excel database and had no problems. I have no idea what I did differently then than what I have tried to do now.

I'm at a loss.

Jenn
  #4  
Old May 26th, 2009, 09:39 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Fields Are Not formatting

The simplest thing is probably to copy/paste your Excel data into a Word
document, then use that as a data source.

If you're doing a one-off, that's fine. If you're trying to create a
solid workplace tool for others to use, Word-Excel connections are a crock.

Peter Jamieson

http://tips.pjmsn.me.uk

MaxArk wrote:
Augh!! Couldn't be any easier. LOL

I had a similar application (mail merge report) that took similar data
from an Excel database and had no problems. I have no idea what I did
differently then than what I have tried to do now.

I'm at a loss.

Jenn




  #5  
Old May 27th, 2009, 02:25 PM
MaxArk MaxArk is offline
Experienced Member
 
First recorded activity by OfficeFrustration: Mar 2008
Posts: 35
Default

Quote:
Originally Posted by Peter Jamieson View Post
solid workplace tool for others to use, Word-Excel connections are a crock.
LOL.

I've spent months working on a great Excel based data processing application. Excel is my tool of choice. Word has a great presentation feature with it's mail merge feature, something Excel lacks in. I'm quite disappointed that integrating them has been so difficult.

What I may consider doing is changing all the date and time cells in the Excel database to simple text once all the calculations are complete. The database uses these values in calculations, so an additional step will be needed to copy the contents of the processed database to a separate worksheet, one with cells being all text. Now ... how complicated will it be to convert date formatted 21-May-09 to pure text 21-May-09?

Jenn
  #6  
Old May 28th, 2009, 11:12 AM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Fields Are Not formatting

I'm
quite disappointed that integrating them has been so difficult.


Yes, it is disappointing.

I don't know what the best way to get text versions of the dates into
another column would be, or how well that would work if you still have a
column with material that /looks like/ mixed data types.

Not being an Excel expert and finding no obvious worksheet function to
do the job in the Text functions group, I'd probably start by writing an
Excel VBA worksheet formula such as

Function astext(sourcecell As Range) As String
astext = sourcecell.text
End Function

and put

=astext(the source cell address)

in each cell in the target column, but I assume there is actually a
better way.

Peter Jamieson

http://tips.pjmsn.me.uk

MaxArk wrote:
Peter Jamieson;3341863 Wrote:
solid workplace tool for others to use, Word-Excel connections are a
crock.



LOL.

I've spent months working on a great Excel based data processing
application. Excel is my tool of choice. Word has a great presentation
feature with it's mail merge feature, something Excel lacks in. I'm
quite disappointed that integrating them has been so difficult.

What I may consider doing is changing all the date and time cells in
the Excel database to simple text once all the calculations are
complete. The database uses these values in calculations, so an
additional step will be needed to copy the contents of the processed
database to a separate worksheet, one with cells being all text. Now
.. how complicated will it be to convert date formatted 21-May-09 to
pure text 21-May-09?

Jenn




  #7  
Old May 28th, 2009, 11:57 PM posted to microsoft.public.word.mailmerge.fields
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Fields Are Not formatting

Hi Peter,

One possibility is to save the Excel ws to a csv file, then use that as the mailmerge data source.

--
Cheers
macropod
[Microsoft MVP - Word]


"Peter Jamieson" wrote in message ...
I'm
quite disappointed that integrating them has been so difficult.


Yes, it is disappointing.

I don't know what the best way to get text versions of the dates into
another column would be, or how well that would work if you still have a
column with material that /looks like/ mixed data types.

Not being an Excel expert and finding no obvious worksheet function to
do the job in the Text functions group, I'd probably start by writing an
Excel VBA worksheet formula such as

Function astext(sourcecell As Range) As String
astext = sourcecell.text
End Function

and put

=astext(the source cell address)

in each cell in the target column, but I assume there is actually a
better way.

Peter Jamieson

http://tips.pjmsn.me.uk

MaxArk wrote:
Peter Jamieson;3341863 Wrote:
solid workplace tool for others to use, Word-Excel connections are a
crock.



LOL.

I've spent months working on a great Excel based data processing
application. Excel is my tool of choice. Word has a great presentation
feature with it's mail merge feature, something Excel lacks in. I'm
quite disappointed that integrating them has been so difficult.

What I may consider doing is changing all the date and time cells in
the Excel database to simple text once all the calculations are
complete. The database uses these values in calculations, so an
additional step will be needed to copy the contents of the processed
database to a separate worksheet, one with cells being all text. Now
.. how complicated will it be to convert date formatted 21-May-09 to
pure text 21-May-09?

Jenn




  #8  
Old May 29th, 2009, 04:30 AM posted to microsoft.public.word.mailmerge.fields
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Fields Are Not formatting

Hi Max,

A macro to modify all the selected Excel cells would be:
Sub Val2Txt()
Dim oCel As Range
For Each oCel In Selection
If IsNumeric(oCel.Value) Then oCel.Value = "'" & oCel.Text
Next oCel
End Sub

--
Cheers
macropod
[Microsoft MVP - Word]


"MaxArk" wrote in message ...

Peter Jamieson;3341863 Wrote:

solid workplace tool for others to use, Word-Excel connections are a
crock.



LOL.

I've spent months working on a great Excel based data processing
application. Excel is my tool of choice. Word has a great presentation
feature with it's mail merge feature, something Excel lacks in. I'm
quite disappointed that integrating them has been so difficult.

What I may consider doing is changing all the date and time cells in
the Excel database to simple text once all the calculations are
complete. The database uses these values in calculations, so an
additional step will be needed to copy the contents of the processed
database to a separate worksheet, one with cells being all text. Now
.. how complicated will it be to convert date formatted 21-May-09 to
pure text 21-May-09?

Jenn




--
MaxArk

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:52 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.