?
Solved

Can you mail merge in Word and bring the font colour from the data set through ?

Posted on 2011-03-03
3
Medium Priority
?
433 Views
Last Modified: 2012-05-11
Hi,

I am actually trying to do this in Publisher but I'm sure if it is possible in Word, it will work in Publisher too.

I have a set of data in Excel. One of the columns contains text that is formatted to different colours depending on the data e.g. if the data is 'A' then the font used is green. 'B' would be orange, etc.

Is it possible to mail merge this data with a Word document and bring the font colour from Excel through into Word so that when the actual data is displayed, it is displayed in the same colour in Word as it is in Excel?

Many thanks
0
Comment
Question by:theabbeyschool
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 35026462
No. The recordset that Word is using does not contain any formatting information. You would have to automate the Excel application, open the workbook and copy the data.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 35027029
If you couls arrange an extra column os the worksheet to have text that depends on the colour of the cell, then you could use IF fields to test the text and then display the field in the appropriate colour.

Here Field a  has the data that you wish to colour and Field b has the differentiating text. I have used the words "Red, "Green" and "Black"

There may be a way of using Excel formulae to fill the colour-indicating column. Rory would know. I am sure that it is possible in VBA

a          b
Tom     Green
Dick     Black
Harry   Red  

Here is a picture of the IF and the MERGEFIELDs in the Word document. (Use Alt + F9 to toggle the field display in the Word document)
Clip0002.jpg
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 1000 total points
ID: 35027190
Here is a simple way to fill the column with colour names in VBA. Note  that in-between shades are not catered for.


Option Explicit

Sub GetColourName()
    Dim r As Integer
    With ActiveSheet
        For r = 2 To 4
            Select Case .Cells(r, 1).Font.Color
            Case 255
                .Cells(r, 2).Value = "Red"
            Case 0
                .Cells(r, 2).Value = "Black"
            Case 65280
                .Cells(r, 2).Value = "Green"
        Next r
    End With
End Sub

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question