Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
sherobot sherobot is offline
external usenet poster
 
Posts: 11
Default mail merge column headers

How do i only show the column headers from the excel file that I am mail
merging into word.

So instead of it saying

first_Name
it says
A
without taking out the header names in the excel file.
I'm trying to do it this way because some of the header names are so long it
messes up the formatting in the word document when I need to print out the
document with only the fields showing
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default mail merge column headers

I don't know of a simple way to do it, assuming that the printed version
needs to match what the user will see.

You can try connecting using Word VBA OpenDataSource and alias all the field
names in the SQLStatement, but that statement has a maximum of either 255 or
511 characters and it will probably only take a few fields with long field
names to exceed that limit - plus, you then have a data source that the user
will probably not be able to filter or sort, or in WOrd 2007, edit the data
from Word. e.g., you might have something like:

Sub ConnectWithAliases()
ActiveDocument.MailMerge.OpenDataSource _
Name:="C:\blah\myxls.xls", _
sqlstatement:="SELECT S.first_name AS `A`, S.last_name AS `B` FROM
[Sheet1$] [S]"
End Sub

(Make sure the quotes around A and B are backquotes, i.e. `` , not straight
quotes, i.e. ''

--
Peter Jamieson
http://tips.pjmsn.me.uk

"sherobot" wrote in message
...
How do i only show the column headers from the excel file that I am mail
merging into word.

So instead of it saying

first_Name
it says
A
without taking out the header names in the excel file.
I'm trying to do it this way because some of the header names are so long
it
messes up the formatting in the word document when I need to print out the
document with only the fields showing


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
sherobot sherobot is offline
external usenet poster
 
Posts: 11
Default mail merge column headers

hmm not sure I could use that because other people would need to work in the
file and don't know much excel. But the work around I found was to insert a
column above row 1(the long descriptive headings) and type in A, B, C
accordingly to match the alphabetized column headings. It just seems
redundant to have to do this. Then when I merge the file I turn off row 2(
the row with my descriptive headings)

"Peter Jamieson" wrote:

I don't know of a simple way to do it, assuming that the printed version
needs to match what the user will see.

You can try connecting using Word VBA OpenDataSource and alias all the field
names in the SQLStatement, but that statement has a maximum of either 255 or
511 characters and it will probably only take a few fields with long field
names to exceed that limit - plus, you then have a data source that the user
will probably not be able to filter or sort, or in WOrd 2007, edit the data
from Word. e.g., you might have something like:

Sub ConnectWithAliases()
ActiveDocument.MailMerge.OpenDataSource _
Name:="C:\blah\myxls.xls", _
sqlstatement:="SELECT S.first_name AS `A`, S.last_name AS `B` FROM
[Sheet1$] [S]"
End Sub

(Make sure the quotes around A and B are backquotes, i.e. `` , not straight
quotes, i.e. ''

--
Peter Jamieson
http://tips.pjmsn.me.uk

"sherobot" wrote in message
...
How do i only show the column headers from the excel file that I am mail
merging into word.

So instead of it saying

first_Name
it says
A
without taking out the header names in the excel file.
I'm trying to do it this way because some of the header names are so long
it
messes up the formatting in the word document when I need to print out the
document with only the fields showing



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
can i use mail merge to change headers throughout many different . Alex[_2_] Microsoft Word Help 7 August 24th 07 07:25 AM
Mail Merge combines characters into one column LCrowe Mailmerge 1 June 7th 07 05:09 PM
Using mail merge date fields in headers Tina Mailmerge 4 March 22nd 07 03:26 PM
Please help - Missing headers in mail merge Earl B Mailmerge 5 April 18th 06 07:30 PM
Excel Column Labels and mail merge Kevin Mailmerge 1 February 16th 05 11:56 PM


All times are GMT +1. The time now is 04:37 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"