Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / October 2007

Tip: Looking for answers? Try searching our database.

mail merge column headers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sherobot - 22 Oct 2007 16:18 GMT
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
Peter Jamieson - 22 Oct 2007 17:13 GMT
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. ''

Signature

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

> How do i only show the column headers from the excel file that I am mail
> merging into word.
[quoted text clipped - 9 lines]
> messes up the formatting in the word document when I need to print out the
> document with only the fields showing
sherobot - 22 Oct 2007 20:54 GMT
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)

> I don't know of a simple way to do it, assuming that the printed version
> needs to match what the user will see.
[quoted text clipped - 29 lines]
> > messes up the formatting in the word document when I need to print out the
> > document with only the fields showing
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.