View Single Post
  #1   Report Post  
Rick Robinson
 
Posts: n/a
Default Word 2003 Mailmerge problem - works in Word 2000

Hi

I have a Word VB script and template .doc file that works fine
with Word 97 & Word 2000, but not with Word 2003. I am running Windows
XP SP1. Word 2003 is version 11.6359.6408 SP1

I get:

Microsoft Visual Basic
Compile error:
Assignment to constant not permitted


The data is exported from an accounts application to a .CSV file. As
soon as the CSV file has been created, Word is invoked.

The Word macro then loads the csv file, along with a Word template
document, that has for example: {MERGEFIELD Contact_Name_CZ} in it.

The first problem is that with Word 2003, I get the error as
documented on this web page:

http://support.microsoft.com/default...B;EN-US;825765

Once I have amended my registry and rebooted to get around the above
error, I try the export again and the VB Macro gives an error saying:

Microsoft Visual Basic
Compile error:
Assignment to constant not permitted

It highlights the word "wddirectory =" and stops.

The relevant snippet is:

If wdtype = "Normal" Or _
wdtype = "Numbered" Or _
wdtype = "List" Or _
wdtype = "Lookup" Then
FileType = wdtype
wddirectory = Documents(File).CustomDocumentProperties("G3000
Directory")
If Err.Number 0 Then
If FileType "Normal" Then
DisplayPropertyError File, "G3000 Directory", " not defined", ""
GetCustomProperties = False
Else
LookupPath = "C:\"
ChangeFileOpenDirectory LookupPath
End If

Once I close that box, it returns to the Word template doco without
filling in the info from the mail merge.

I have Word 2000 installed on the same machine and so it's using the
same dataset. Word 2000 works, Word 2003 doesn't.

What needs to be changed in the VB script? I have searched google.com
to no avail.

Cheers, Rick