Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 05-07-2020, 05:47 PM
FredNerk FredNerk is offline Colour code mail merge header table cell backgrounds Mac OS X Colour code mail merge header table cell backgrounds Office 2016 for Mac
Novice
 
Join Date: May 2020
Posts: 10
FredNerk is on a distinguished road
Default

Thank you Paul - I got it! :-)




it is working!


Now, a further question on this please if I may - the ouput is good, but "ragged" in the cell as I have centred the output in a reasonably wide cell. There are some job/document titles that are quite lenghty.


I am not certain there is an easy answer to this but can the entire cell be shaded from within this mail merge code?


Thank you for your insight and assistance Paul - regards


Wayne
Reply With Quote
  #17  
Old 05-07-2020, 05:54 PM
FredNerk FredNerk is offline Colour code mail merge header table cell backgrounds Mac OS X Colour code mail merge header table cell backgrounds Office 2016 for Mac
Novice
 
Join Date: May 2020
Posts: 10
FredNerk is on a distinguished road
Default

Actually, hold that thought please Paul - I think that is why you were padding out the field with Tabs and soft returns ... Correct?


Wayne
Reply With Quote
  #18  
Old 05-07-2020, 06:02 PM
macropod's Avatar
macropod macropod is offline Colour code mail merge header table cell backgrounds Windows 7 64bit Colour code mail merge header table cell backgrounds Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Correct. Otherwise the cell won't all have the highlight. Read closely, post #2.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #19  
Old 05-07-2020, 10:47 PM
FredNerk FredNerk is offline Colour code mail merge header table cell backgrounds Mac OS X Colour code mail merge header table cell backgrounds Office 2016 for Mac
Novice
 
Join Date: May 2020
Posts: 10
FredNerk is on a distinguished road
Default

Hello Paul


The shading of the cell is now working really well. Thank you!



I am having difficulty centering that selection in the table cell - height is OK, but I cannot get it centred across the page. Are there controls within \*CHARFORMAT that I can use do you think?


Thank you - regards




Wayne
Reply With Quote
  #20  
Old 05-07-2020, 11:02 PM
macropod's Avatar
macropod macropod is offline Colour code mail merge header table cell backgrounds Windows 7 64bit Colour code mail merge header table cell backgrounds Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The centring can only be done via tabs, for which you should use a centre-aligned tab-stop. The \* Charformat switch is only for character formatting.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #21  
Old 05-08-2020, 12:44 AM
FredNerk FredNerk is offline Colour code mail merge header table cell backgrounds Mac OS X Colour code mail merge header table cell backgrounds Office 2016 for Mac
Novice
 
Join Date: May 2020
Posts: 10
FredNerk is on a distinguished road
Default

Thank you


Cheers
Reply With Quote
  #22  
Old 09-24-2021, 02:04 AM
jessenox0 jessenox0 is offline Colour code mail merge header table cell backgrounds Windows 10 Colour code mail merge header table cell backgrounds Office 2019
Novice
 
Join Date: Sep 2021
Posts: 2
jessenox0 is on a distinguished road
Default

Hi Paul thanks for your guidance on this, but I am also having issues.
Can I just ask is it possible for a table shading of orange color or it's not possible due to the fact the way it's driven is by Highlighting text?
I appreciate your response.
Reply With Quote
  #23  
Old 09-24-2021, 10:42 PM
macropod's Avatar
macropod macropod is offline Colour code mail merge header table cell backgrounds Windows 10 Colour code mail merge header table cell backgrounds Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The technique discussed in this thread is for changing the colour of the cell itself, via highlighting. For that, you're limited to Word's highlight options, which don't include orange.

Another possibility is to colour the text itself - for which your options are virtually unlimited. See the relevant discussions in the Mailmerge Tips & Tricks thread: https://www.msofficeforums.com/mail-...ps-tricks.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #24  
Old 09-24-2021, 10:57 PM
jessenox0 jessenox0 is offline Colour code mail merge header table cell backgrounds Windows 10 Colour code mail merge header table cell backgrounds Office 2019
Novice
 
Join Date: Sep 2021
Posts: 2
jessenox0 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
The technique discussed in this thread is for changing the colour of the cell itself, via highlighting. For that, you're limited to Word's highlight options, which don't include orange.

Another possibility is to colour the text itself - for which your options are virtually unlimited. See the relevant discussions in the Mailmerge Tips & Tricks thread: https://www.msofficeforums.com/mail-...ps-tricks.html
Thanks Paul, I am impressed that you remain active and still respond after all these years. Thank you so much for your dedicated, I am so impressed with your skills and responses. Paul, I really need orange for table shading so I guess VBA would be more of a goer. Do you provide VBA help as well? The table section i'd like color shaded is like the Second column of a table, has it's own table. I was thinking of vba but how on earth do I specific that specific area only. Any thoughts?
Reply With Quote
  #25  
Old 09-24-2021, 11:47 PM
macropod's Avatar
macropod macropod is offline Colour code mail merge header table cell backgrounds Windows 10 Colour code mail merge header table cell backgrounds Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by jessenox0 View Post
I am impressed that you remain active and still respond after all these years.
I'm actually no longer active. I responded only because the forum still notifies me of replies to discussions I've previously participated in.
Quote:
Originally Posted by jessenox0 View Post
Do you provide VBA help as well? The table section i'd like color shaded is like the Second column of a table, has it's own table. I was thinking of vba but how on earth do I specific that specific area only. Any thoughts?
It's not apparent to me what you mean by: "the Second column of a table, has it's own table".

Some generic code you could adapt is:
Code:
Sub MailMergeToDoc()
Application.ScreenUpdating = False
Dim Tbl As Table, r As Long
ActiveDocument.MailMerge.Execute
For Each Tbl In ActiveDocument.Tables
  With Tbl
    For r = 1 To .Rows.Count
      With .Cell(r, 2)
        If Split(.Range.Text, vbCr)(0) = "my condition" Then
          .Shading.BackgroundPatternColor = wdColorOrange
        End If
      End With
    Next
  End With
Next
Application.ScreenUpdating = True
End Sub
Note: As coded, the above macro intercepts Word's 'Edit Individual Documents' button to complete the merge and apply the shading.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #26  
Old 11-04-2021, 02:07 PM
beldel beldel is offline Colour code mail merge header table cell backgrounds Windows 10 Colour code mail merge header table cell backgrounds Office 2019
Novice
 
Join Date: Nov 2021
Posts: 2
beldel is on a distinguished road
Default

Hi Paul,

I've read every thread on this I can find - have you done a youtube tutorial on it? I generally find them easier to follow as I'm very new to this.

I have tried to attach a screenshot of what I've done here - it highlights the text, but I need the cell shaded.

I don't understand how/what to do with the tab/enter commands to create the shading or exactly what keys to use. If I try copy/pasting your tab/enter symbols, they just display in the highlighted output. If I try to actually press the tab key, it just selects the next table cell.
Attached Images
File Type: png example 1.PNG (6.1 KB, 7 views)
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to immediately change the colour of a cell depending on the code placed in anothe Phil Payne Excel Programming 2 07-27-2013 11:04 PM
Mail Merge Code (Default Display) ochiha_ita Mail Merge 3 04-22-2013 04:04 AM
Colour code mail merge header table cell backgrounds Mail merge in a header Kizzy Mail Merge 1 08-13-2012 10:50 AM
Mail merge Field Code Manipulation macjnr Mail Merge 0 09-10-2009 11:37 AM
Colour code mail merge header table cell backgrounds Code for Changing Cell Backgrounds leroytrolley Excel 2 12-05-2008 02:05 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:31 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft