Automating Mailmerge using CSV results in squares / Japanese characters
I have noticed that when you actually open the document, its encoding
(i think) is wrong. I have tried the UK (20285), Auto Detect (50001),
UTF-8 ( 65001), MSOENCODINGUSASCII (20127) & MSOENCODINGWESTERN (1252)
and many more . It works if I click on it in Explorer. I am running
the code locally so I dont think it would be a server setting). What
could be doing this?
Dim aLocalWdApp As Word.Application
Dim aLocalDoc As Word.Document
Dim strFilePath As String
strFilePath =
HttpContext.Current.Server.MapPath(db.m_Global_Doc ument_Path)
Dim strTemplateName As String = "Reminder1Letters.dot"
aLocalWdApp = New Word.Application
aLocalWdApp.ChangeFileOpenDirectory(strFilePath)
aLocalDoc = aLocalWdApp.Documents.Open(FileName:=strFilePath &
strTemplateName, Format:=4, Encoding:=20285)
aLocalWdApp.Visible = True ' PUT A BREAK HERE
aLocalDoc.Close()
aLocalWdApp.Quit()
|