Word 2003 Mailmerge problem - works in Word 2000

R

Rick Robinson

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.aspx?scid=KB;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
 
P

Peter Jamieson

The problem is that the mail merge type "Catalog" that existed in Word 2000
has been renamed to "Directory", and a new constant was introduced
(wdDirectory) to reflect this. So that is the constant that your code is now
trying to change - you will need to rename your wddirectory variable to
something else throughout your code.

Peter Jamieson
 
R

Rick Robinson

Peter,

Thanks - you're a star!

- Rick


The problem is that the mail merge type "Catalog" that existed in Word 2000
has been renamed to "Directory", and a new constant was introduced
(wdDirectory) to reflect this. So that is the constant that your code is now
trying to change - you will need to rename your wddirectory variable to
something else throughout your code.

Peter Jamieson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top