Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
I appologize for not getting back you. I was waiting for an email notifying
me of replies but it never came! You are correct, I did mean that it shows up when there is only one column in the data file not just one merge field. I will try the odc route. I did read something about that elsewhere but was hoping to find an easier solution like some flag you have to set. Thanks for the information!. Nick "Peter Jamieson" wrote: No one has any information that might be helpful for this? I needed to check some stuff (and still need to!). I don't think it makes a whole lot of difference, but which version(s) of Word are you working with? On the other hand, if the document only has one merge field, then before merging, AFAIK this problem only arises when the data source only has one column - i.e. it has nothing to do with the number of merge fields you place in the document. That's what I experience here, but please say if your experience is different. The simplest solution is, I suppose, to ensure that your data source always has more than one column, if you have control over that. If you have control, you might also be able to use a slightly less simple file format (e.g. you might be better off writing out a very basic HTML file that uses a table structure to hold the data). Although Word does store info. about the delimiters, at least in some situations, a. if it does in this case, it doesn't appear to use it anyway b. there is no way to specify the delimiter characters in OpenDataSource or using any other method or property in the Word object model There are two other possible approaches to a workaround, one of which I've never attempted: a. use Sendkeys (or a Win32 message) to OK the dialog. Since you're automating Word, you might be able to do that from your C# program. But you'd probably also have to know in advance whether you needed to do it or not. Never tried it. b. use a .odc file to connect to the data source. e.g. to connect to a file called c:\\myfiles\\mysource.txt you could have a file called mysource.odc that has the following content: html head meta http-equiv=Content-Type content="text/x-ms-odc; charset=utf-8" meta name=ProgId content=ODC.Table meta name=SourceType content=OLEDB meta name=Table content="mysource#txt" xml id=docprops/xmlxml id=msodcodc:OfficeDataConnection xmlns ![]() ![]() ![]() xmlns="http://www.w3.org/TR/REC-html40" odc:Connection odc:Type="OLEDB" odc:ConnectionStringProvider=Microsoft.Jet.OLEDB .4.0;User ID=Admin;Data Source=C:\myfiles;Mode=Share Deny None;Jet OLEDB:Engine Type=96;/odc:ConnectionString odc:CommandTypeTable/odc:CommandType odc:CommandTextmysource#txt/odc:CommandText /odc:Connection /odc:OfficeDataConnection /xml /head /body /html (NB, there's normally more in a .odc than that, but you shouldn't need the rest of it) When you connect manually using OLE DB, Word would also normally ask for a field delimiter character (with OLE DB/Jet, the record delimiter has to be CRLF or perhaps a variant such as CR). So you would have the same problem. But when you connect via a .odc, Word doesn't seem to ask, and of course it doesn't actually need to know because there are no field delimiters. But a. OLE DB/Jet only works for text files with up to 255 fields b. there could be trouble if you have one of the common delimiters on your data c. etc. For more info on this approach, I suggest you look at http://groups.google.com/group/micro...9588c43fc31d70 Peter Jamieson http://tips.pjmsn.me.uk On 09/04/2010 02:29, Nick Olsen wrote: No one has any information that might be helpful for this? "Nick Olsen" wrote: I have a C# application that performs an automated Word mail merge. The data souce is just a tab delimited text file I create. If the mail merge document has more than one merge field (and obviously the data source has more than one data field) then the merge goes smoothly without any required action by the user. On the other hand, if the document only has one merge field, then before merging, Word pops up with the Header Record Delimiters dialog box requiring me to specify the Field and the Record delimiter. The selected values, none and enter respectively, are correct so the only thing I have to do is click OK. I'm not sure how to go about getting rid of this window. Is there any way to programatically specify the delimiters? Is there something I can do to the data source file so that this won't show up? Thanks Nick . |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to eliminate the Header Record Delimiters pop up screen | Mailmerge | |||
Header Record Delimiters dialog when opening mailmerge document | Mailmerge | |||
What are header record delimiters? | Mailmerge | |||
bypassing empty merge fields | Mailmerge | |||
Header Record Delimiters fails . . . | Mailmerge |