• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 340
  • Last Modified:

Mail Merge

I have an existing Word Document and want to merge line to specific positions in the letter

There is a Logo on the right side and below that on the left I need a Date Then Name Address then after the Section Probation Letter I need to add Dear XXXXX I dont want to insert lines, is there a way to add the information to a position in the Document without moving the existing letter down with inserts

Document -

Date:



[Given Name] [Surname]
[Address Line 1]
[Suburb] [State] [Postcode]

Probation Letter (Existing in Document)


Dear [Given Name],

Congratulations on the successful completion of your probation period
0
Kevinfeening
Asked:
Kevinfeening
  • 4
  • 3
1 Solution
 
John HurstBusiness Consultant (Owner)Commented:
I put the fields in an Excel File with titles as you showed at the top of each row, create a basic letter and use the Word Mail Merge Wizard. It allow you to insert as need. The spacing of my letter does not change when I do this. Make sure your field is <....> with no spaces before or after.

The wizard allows you to check formatting and correct before completing the merge and printing.

... Thinkpads_User
0
 
KevinfeeningAuthor Commented:
sorry This is done in Delphi using

// Create an instance of Word and make it visible
  wrdApp := CreateOleObject('Word.Application');
  wrdApp.Visible := True;
  // Create a new document
  wrdDoc := wrdApp.Documents.Add(fname);
  wrdDoc.Select;

  wrdSelection := wrdApp.Selection;
  wrdMailMerge := wrdDoc.MailMerge;

  // Create MailMerge data file
  CreateMailMergeDataFile;

  // Insert Merge Data
  wrdSelection.ParagraphFormat.Alignment := wdAlignParagraphLeft;
  wrdMergeFields := wrdMailMerge.Fields;
  InsertLines(10);
  wrdMergeFields.Add(wrdSelection.Range,'FirstName');
  wrdSelection.TypeText(' ');
  wrdMergeFields.Add(wrdSelection.Range,'LastName');
  wrdSelection.TypeParagraph;
  wrdMergeFields.Add(wrdSelection.Range,'Address');
  wrdSelection.TypeParagraph;
  wrdMergeFields.Add(wrdSelection.Range,'City');
  InsertLines(2);
  wrdSelection.ParagraphFormat.Alignment := wdAlignParagraphJustify;
  wrdSelection.TypeText('Dear ');
  wrdMergeFields.Add(wrdSelection.Range,'FirstName');
  wrdSelection.TypeText(' ');
  InsertLines(1);
0
 
ITugayCommented:
Just a suggestion.
Use some reporting tools to create resulting form. Save it as .pdf format. IMHO  more preferable way in email then  MS Word document.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
KevinfeeningAuthor Commented:
Sorry I don't understand it's not an email and they don't want a pdf file its a Form letter to selected staff from a Interbase Database I insert the name Address from then database into the existing MS Word document and then they print and post to the staff. I need to know if you can insert the name address and Dear XXXXXX in specific spots in the MS Word Document without the existing information moving from its origional saved Word Document position.

Thanks
0
 
ITugayCommented:
So, place variables in existing MS Word document, then assign data to that variables in your application.
0
 
KevinfeeningAuthor Commented:
How do you add variables using MS Word and how to you assign data to them or find them using Delphi
0
 
ITugayCommented:
Way to go:
How to store and retrieve variables in Word documents
http://support.microsoft.com/kb/306281/en
0
 
KevinfeeningAuthor Commented:
Thanks tried the example but it has problems is it the same code for Delphi
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now