Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-13-2024, 09:04 PM
macropod's Avatar
macropod macropod is offline Generating Letters from Excel List Windows 10 Generating Letters from Excel List Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

In that case, the SELECT FROM statement becomes:


SELECT [#] AS `FER`, `Year`, [InstrumentNo ] AS `Instrument No`, `Date`, `Terms`, `CCY`, Format([Amount],'#,0') AS `Amount` FROM
And, for the switches use:
\l "1" \b "16" \h

As for the centering & header row formatting, add the following macro in your mailmerge main document to drive the process:
Code:
Sub MailMergeToDoc()
Application.ScreenUpdating = False
Dim Tbl As Table
ActiveDocument.MailMerge.Execute
With ActiveDocument
  For Each Tbl In .Tables
    With Tbl
      .Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
      .Rows.Alignment = wdAlignRowCenter
      .Rows(1).HeadingFormat = True
      .Rows(1).Range.Font.Bold = True
      .Rows(1).Range.Shading.BackgroundPatternColor = wdColorAqua
    End With
  Nexxt
End With
Set Tbl = Nothing
Application.ScreenUpdating = True
End Sub
Clicking on the 'Edit Individual Documents' button in Word will intercept the merge and run the macro automatically. The potential disadvantage of intercepting the merge this way is that you no longer get to choose which records to merge at that stage. However, you can still achieve the same outcome - and with greater control - via the 'Edit Recipient List' tools.

I haven't been able to match your exact shading using Word's presets. The full set of presets for blue shades of various kinds are:
wdColorAqua, wdColorBlue, wdColorBlueGray, wdColorLightBlue, wdColorLightTurquoise, wdColorPaleBlue, wdColorSkyBlue, wdColorTeal, wdColorTurquoise
Other than using one of those, you could use:
Code:
.Rows(1).Range.Shading.BackgroundPatternColorIndex =
with the numeric value or RGB values of the color you want.

Note: You will need to save your mailmerge main document in the .docm format.

For PC macro installation & usage instructions, see: Installing Macros
For Mac macro installation & usage instructions, see: https://wordmvp.com/Mac/InstallMacro.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating a vertical classification list AP41-at-OfficeFORUM Excel 11 01-27-2023 11:59 AM
Batch generating word template with CC from excel data Caerleon Excel Programming 1 11-15-2022 08:46 PM
Generating Letters from Excel List Mail Merge - generating multiple letters myspoonistoobig Mail Merge 8 10-16-2015 12:03 AM
Generating Fresh Copies Of an Excel Document callumwk Excel 2 04-09-2012 06:13 AM
Generating Letters from Excel List Letters change size in folders list nsv Outlook 1 08-19-2010 03:48 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:12 PM.


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