Mail Merge problem with File Conversion
Here's a work around that opens the textfile with the necessary encoding,
converts the information in it into a table then saves it as a Word document
and then attachs that document to the activedocument (the mail merge main
document) as the data source:
Dim source As Document
Dim Browsefile As String
With Dialogs(wdDialogFileOpen)
If .Display -1 Then
Browsefile = ""
Else
Browsefile = WordBasic.FileNameInfo$(.Name, 1)
End If
End With
Set source = Documents.Open(FileName:=Browsefile,
Encoding:=msoEncodingWestern)
source.Range.ConvertToTable Separator:=";"
source.SaveAs FileName:=Browsefile & ".doc", FileFormat:=wdFormatDocument
source.Close
ActiveDocument.MailMerge.OpenDataSource Name:= _
Browsefile & ".doc" _
, ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="",
_
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False,
_
Format:=wdOpenFormatAuto, Connection:="", SQLStatement:="",
SQLStatement1 _
:="", SubType:=wdMergeSubTypeOther
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"Joergen Bondesen" wrote in message
...
Hi NG.
I am having problems with Mail Merge.
I am living in Denmark, but are using UK MS-Office 2003 and UK Windows XP,
SP2.
When I merge manual with a text file, I get this dialog box: "File
Conversion" where Text encoding is "Other encoding" (Japanese
(Shift-JIS)).
This shut be "Windows (Default)" because in Denmark, we are using sign
such as æ, ø and å and they must not be displayed as strange sign, e.g.
square. Customer is not happy about this.
I have a lot of Mail Merge, and therefore I am merging automatically, so
how do I tell Word to use "Windows (Default)".
E.g. Text-file:
No;FirstName;LastName
4232;Jørgen;Åmund
--
Best Regards,
Jørgen Bondesen
|