word-field

How do you substring a MERGEFIELD in Word?

This one has me puzzled. It seemed like an easy task, but the solution eludes me: - How do you substring a merge field in a Word template used for mail merging? For example, I have something like {MERGEFIELD barcodevalue} and I want to extract the first 6 characters as it is at the same time an identifier for something else. I can find...

Word Mail merge crashing with many records

I have a VFP form where the user can print the invoices for a batch of client. Each invoice can be preceded by a cover letter written in Word by the user. The printout is done on a multiple bins printer. Here's the logic: - Create the cursor for the cover letters - Create the cursor for the invoices - Create the mail merge in Word: ...

Word Mail Merge for SQL

I'm having some performance issues since a DB was moved from SQL2000 to SQL2008. We need to retrieve from a SQL View for a mail merge and for an application called FORMIC. It was fine under SQL 2000, but is now very, very slow. One thing I've noticed is that SQL Profiler shows that Excel does a simple "SELECT * FROM VIEW" where Word se...

In Word, how can I alter mail merge data programmatically with VBA?

I have a Word document that is used as the source document for a mail merge. I can edit the document, but not the data being used for the merge. I need to transform some of the data in the data source (specifically, I need to take numbers (e.g. 342) and add their value in words (e.g. "three hundred forty-two (342)")). I can write a VB...

Excel 2007 is locked when used as a datasource for Word Mail Merge

When using Word 2007 MailMerge with an Excel 2007 (xlsx) as a datasource, the .XLSX file is locked and cannot even be copied using Windows Explorer. It is possible to connect to the Excel file as a datasource (using Visual Studio 2008 and .NET 3.5) but it is not possible to use the Office automation or similar third party components. We...

Fields mailmerged into a Table in MS Word

Hoping someone might have an example of a MailMerge to a Word document that list rows of items in one table, each row having five columns of corresponding data. The problem I am running into is that it wants to create a new complete table for each item in the first column. ...

Primitive MailMerge using just delimited field names

Obviously the correct way for our app to generate a Word document based on a template is to encourage the admin users (who will look after the templates) to embed the correct merge fields or bookmarks in the template document. However in the past we have found our typical admin user who ordinarily doesn't use MailMerge or any of the oth...

Word MailMerge automation - Find out the data source's encoding

I have a Word add-in I wrote using .NET. The add-in basically processes a Word document which is configured for MailMerge and extracts the data from the data source. I need to know which encoding Word uses to access that data source. When I use a datasource (CSV for example) that is not encoded with my default system locale, Word alerts...

MailMerge script to merge headers/footers?

I'm writing a script to merge 2 Word templates into 1 master document, depending on some criteria. This is what I have so far: {if mergefield effort_ } = 5 "{ includtext "C:\\1\\PL5.doc"}" ""{includetext "C:\\1\\PL6.doc"}"} The merged doc works fine, but in my PL5 and PL6 files, I have some headers and footers. The merged doc can only ...

automatically Match fields in word

How does Microsoft Word match fields in MailMerge automatically? For example: Word searches for the column that matches each element. In the illustration, Word automatically matched the data file's Surname column to Last Name. But Word was unable to match other elements. From this data file, for example, Word can't match...

Mailmerge Field not always saved the same way in Word .docx

I have created a Word document with Word 2003 and inserted some MergeField via the GUI. I have saved it as a .docx by using Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats. Some Mergefields are stored as a SimpleField, while others are stored as a FieldCode (with start-FieldChar and end-FieldChar). S...

Using VBA in MS Word 2007 to define page elements?

I'd like to be able to create a page element which I can feed text and it will form itself into the preferred layout. For instance: {MACRO DocumentIntro("Introduction to Business Studies", "FP015", "Teachers' Guide")} with that as a field, the output should be a line, the first two strings a certain size and font, centred, another lin...

Conditionally format a Word document based on db-records

I realize that generally speaking I'm quite a bit of a newb, but here's what I'm trying to do: I have a sheet in Excel with all the details of the participants in a conference I'm organising. I want to send them all a letter with their personal programme. Using MailMerge (MS Office 2003), I can easily import their address-info into a ba...

Excel VBA MailMerge question

http://stackoverflow.com/questions/1357121/executing-word-mail-merge-from-excel-macro Is there anyway to set it up to send the mailmerge to the printer rather than create a new file? ...

Remove MailMerge data source via OpenXML

I have some code that uses Open XML to open up a .docx file, find all MailMerge fields, and replace them with data (ignoring the datasource that may have been provided). I initially tested this against a document created in Office 2007 and it seemed to work great. We then created one in 2003 based off an Excel spreadsheet data source ...

Display date difference in MS Word field

I have an CV and would like to automatically update my age when opening. So, what formula should I insert in a MS Word field? Something like: {= {DATE} - {"01/01/1983"} } ...

MS Word: Mailmerge hyperlinks with query get URL string with a MERGEFIELD

I'm trying to send an email merging one document (.docx) with a contacts database (via OleDB). Using MS Word 2007, it seems easy (it works for easy things: name, address, ...) but I can't find how fill an query-get URLD string with a merge field inside an hyperlink. An hyperlink like: Click here where here is an hyperlink to http://...

Word MERGEFIELD wildcard not correctly matching

Below is my MERGEFIELD code: { IF { MERGEFIELD Subs_State } = "GA" "blah blah" "{ IF { MERGEFIELD CEOrgStates } = "*GA*" "blah blah" ""} "} I'm pulling records from a MS Access database. My goal is to check whether a record has Subs_State field matching "GA", or the CEOrgStates has the word "GA" (some records have stuff like "|FL|CA|GA...

Word 2003 mailmerge to separate files or print to PDF

I created a mailmerge from a single page which resulted in one document with about two hundred pages. What I need is a way to create separate files for each of these. The way I see it, I have two options: Create about 200 Word documents I can print directly to PDF (Acrobat Distiller installed). with PDF printer set as default, I can t...

Can you use a web service as a datasource for a mailmerge

Some clients of ours want to use data (SQL Server backend) in a web application we've developed to generate some documents (agreements, contracts, etc). They'd also prefer to have the document templates to be in a form they are familiar with and can easily generate new ones. My initial thought was to create a SQL Server Reporting Servi...