Reply
 
Thread Tools Display Modes
  #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






  #2   Report Post  
Peter Jamieson
 
Posts: n/a
Default

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

"Rick Robinson" wrote in message
...
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








  #3   Report Post  
Rick Robinson
 
Posts: n/a
Default

Peter,

Thanks - you're a star!

- Rick


On Wed, 27 Apr 2005 17:43:13 +0100, "Peter Jamieson"
wrote:

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

"Rick Robinson" wrote in message
.. .
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








Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
In Word, how can I see all files (*.*) in "save as"? citizen53 New Users 8 April 4th 05 04:56 PM
WordPerfect keyboard macro>Word equivalent? Anty New Users 2 March 13th 05 07:23 PM
letters - ask/fillin Caroline H New Users 2 February 25th 05 09:19 PM
copying files from Wordperfect to Microsoft Word Juliet New Users 1 January 31st 05 06:41 PM
How to change merge forms from Word Perfect to Microsoft Word dollfindance Microsoft Word Help 2 December 30th 04 04:35 PM


All times are GMT +1. The time now is 11:42 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"