+ Reply to Thread
Results 1 to 2 of 2

Applying formatting to specific repeated blocks of text in Mail Merge generated documents

  1. #1
    Registered User
    Join Date
    03-29-2012
    Location
    U.S.A.
    MS-Off Ver
    Excel 2007
    Posts
    2

    Applying formatting to specific repeated blocks of text in Mail Merge generated documents

    A few points to make that may be useful in explaining my problem:
    1. I have had C++, Visual Basic, and Javascript courses freshman year of college many years ago; my understanding of how to write code is very basic and I remember only bits adn pieces.
    2. The formatting I am trying to achieve is designated by my employer and is not subject to change

    My Problem:
    I have an excel document that contains the source data for a 'cheat sheet' of the person hosting a fundraising event for my company. These documents will contain data on guests attending the function. Here is a sample of the layout we are to use in the Mail Merge template:

    Name - Residence
    Field: Data
    Field: Data
    Field: Data

    BLOCK OF TEXT

    Fields are entries such as age, spouse, etc. The BLOCK OF TEXT is where my problem originates. This block of text contains data on the individuals company; data is imported from a database into excel, then mail merged to word. Becasue of the multiple imports and exports the formatting forces everything to a single wrapped line. I need to separate out certain headings, (ex: Company Name: ) and then adjust the lines that follow to be bulleted underneath 'Company Name' until the next heading, (ex: Capactiy Rating). These headings within the block of text are consistent for each data set throughout the entire mail merge. I currently have a macro that will sort out these headings, make them bold, and list the corresponding data beneath each as bullets, but only when this block of text is the only text on a single document (e.g: this macro only works when I copy and paste the block of text to a new Word Document, such that it is the only text that exists). When I run the macro with the entire Mail Merge, the formatting does not work at all.

    My Question:
    Is it possible/how can I command this macro to only perform its functions on a portion of each page, (i.e.: between the lines that begin with 'Company Name' and end with the data after 'Capactiy Rating', for each document page of the Mail Merge?

    I want the final product to look like this, but repeated for each individual data set:
    Name - Residence
    Field: Data
    Field: Data
    Field: Data

    Company Name
    • Data
    • Data
    Another Heading
    • Data
    • Data
    Etc
    • Data
    • Data
    Capactiy Rating
    • Data
    • Data

    NEXT PAGE

    Name - Residence
    Field: Data
    Field: Data
    Field: Data

    Company Name
    • Data
    • Data
    Another Heading
    • Data
    • Data
    Etc
    • Data
    • Data
    Capactiy Rating
    • Data
    • Data

    I apologize for such a long post; I want to be as clear as possible on what I am asking. Any help at all would be MUCH appreciated and save us days of formatting entries manually; the list is quite long.

    **Additionally, and this is less pertinent, my current macro applies bullets before my headings too, which is undesirable but is acceptable if I can't find another way. Is there a way to apply the bullet list style to just the data I have beneath each heading, (so that it appears as above)? I have tried writing a macro to remove said bullet style from just the headings but cannot get this to work either.

    **BLOCK OF TEXT originally looks like this: Company Name:data data data data Heading data data data data Heading data data data etc etc etc etc for many many lines.

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Applying formatting to specific repeated blocks of text in Mail Merge generated docume

    Having disparate data in a single mergefield, as your post suggests, is a bad idea. As you've discovered, making any formatting changes then requires a lot of post-processing. It would be far simpler to keep the data discrete, so that each field's formatting can be controlled up front.

    Any particular reson you're not using the original database as the mailmerge source, rather than your present round-about method?
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1