View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Compile error: Assignment to constant not permitted

wdSuffix is the name of a predefined enum constant in the Word object
(it's a member of the wdMappedDatafields enumeration), and setting it in
Word 2007 does cause the error you describe. I would actually expect the
same error in Word 2003 but not in Word 2000 because the relevant
enumeration wasn't defined in that version.

I guess you could choose a different variable name, or possibly use

Dim wdSuffix

within your function/sub to ensure that the name references a local
variant rather than the predefined constant.

Peter Jamieson

http://tips.pjmsn.me.uk

rick-global wrote:
I have a Word VB Script and template .doc file that has been working for many
years. Suddenly it seems to have stopped working using Word 2007. The code
still works perfectly on Word 2000. I did have a problem on Word 2003 back
in April 2005 but this was resolved by Peter Jamieson on this forum, which I
then tested with Word 2007 in 2006 & I recall it was fine.

Now I get:

"file conversion [filename], select the encoding that makes your document
readable"

followed by "Compile error: Assignment to constant not permitted"

See: http://www.sonytino.com/word2007/cerror.jpg

Any clues on how to fix this would be appreiciated.

As I said, Word 2000 works fine - no errors & it just creates the mailmerge
document with no problems.

Thanks