Word 2007 Report Problem

Gon_M.
Gon_M. Member Posts: 34
Hi Experts:

My Problem is this:

I'm trying to create a report from Navision to Word (Using Automation of course). I tried this based in examples that I find in forum and it worked fine for Word 2003, but when I tried to do the same in Word 2007 I get this error during compilation:

"The variable WRDAPP::MAILMERGEDATASOURCEVAL is defined more then once."

where WRDAPP = 'Microsoft Word 12.0 Object Library'.Application

Any suggestion to avoid this error?

Thanks in advance.

Answers

  • zeninoleg
    zeninoleg Member Posts: 236
    Rename your variable to WD, basically reduce number of characters in the variable name, so more space is left for the function itself. You can search this forum as well. I have seen many posts about it.
    The problem happens when you have functions like
    MAILMERGEDATASOURCEVAL1 and
    MAILMERGEDATASOURCEVAL2
    navision takes only certain number of characters and cuts off the 1 and 2, so you end up with 2 same functions
    Hope taht helps
    Best Regards,
    Oleg
  • Gon_M.
    Gon_M. Member Posts: 34
    Hi Oleg:

    thanks for reply.

    You are right. this is the cause of my problem.

    Anyway I tried again with a shorter name of var and I get the same error, even I set 1 char name, and it didn't work. The length of function is too much long.

    I think that I have to take an alternative way.

    Regards.
  • zarryn
    zarryn Member Posts: 29
    This problem may be caused by the "WithEvents" property on the automation variable. If you are not using any of the events, you can set this property to no (or it may already be no). Then, you must export the object to text and delete all of the event functions towards the end of the file. Import the object and re-compile. This should resolve the issue.

    If you are using any of the events, then do not use this method.

    I hope this helps.
    Zarryn
  • Gon_M.
    Gon_M. Member Posts: 34
    It Works!!!

    Thank you zarryn.