Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
rick-global rick-global is offline
external usenet poster
 
Posts: 1
Default Compile error: Assignment to constant not permitted

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
  #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

  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
rick-global[_2_] rick-global[_2_] is offline
external usenet poster
 
Posts: 1
Default Compile error: Assignment to constant not permitted

Thanks for your help again Peter, that worked & no more compile error.

- Rick


"Peter Jamieson" wrote:

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


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
compile error Skimore Microsoft Word Help 2 June 7th 07 12:45 AM
Stop error message - "Compile Error in hidden module appearing" Howard18 Microsoft Word Help 1 October 20th 05 05:12 PM
MVB error- compile error method or data member not found jvb70 Microsoft Word Help 0 July 29th 05 05:39 PM
I am getting an error "compile error in hidden module" at MS Word. PJC Microsoft Word Help 1 April 15th 05 01:02 PM
Compile error Daniel Microsoft Word Help 2 February 13th 05 06:10 AM


All times are GMT +1. The time now is 05:15 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"