WordManagement CU compilation error

rajpalrajpal Member Posts: 10
Hi,

My motive is to add 1 field in the WordManagement Codeunit in three functions - ExecuteMerge, ShowMergedDocument and CreateHeader which would provide this field in the mail merge document created on fly.

I have Win 2000 Prof OS and MS Office 2000.

Before adding the code in the CU 5054, if I compile, it flashes an error
" You have specified an unknown Variable - OpenDataSource2000 - Define the variable under Global C/AL Code"

So, does this error appearing after I add the code for adding field in the document. I saved the object without compiling it and executed the Show button on the Interaction Log Entries Form. But it gives an error saying that the CU should be compiled.

If anybody has encountered such a problem, pls share the solution with me.

Thank you in advance.

Comments

  • garakgarak Member Posts: 3,263
    Oh, you are shure that you have Word 2000 :?:

    Can you compile it with "OpenDataSource" :?:

    You can also see which function you need, if you make a manuel Mailmerge in Word with open an datasource (active the Macrofunction to record). Take a look into the Macro. Ther you can see which function you need.

    Regards
    Do you make it right, it works too!
  • rajpalrajpal Member Posts: 10
    I have MS Office 2000 installed on the with OS as Win 2000 Prof and Navision 4.0 , but still it gives the error

    I tried compiling this particular on a pc with OS XP and Office 2003, it got compiled and I was able to add the field I wanted to.

    Does it have something to do with the compatilbility of Office and OS used with the version of Navision.

    Kindly advice in detail.....
  • garakgarak Member Posts: 3,263
    Since Office 2001 / 2002 exist the function OpenDataSource2000.
    When you will use an older office (97,98,2000) you must change the code to
    OpenDataSource.

    An example:
    {Function}
    CreateWordAttachment(WordCaption : Text[260]) NewAttachNo : Integer
    
    Attachment."File Extension" := 'DOC';
    
    IF ISCLEAR(wrdApp) THEN
      CREATE(wrdApp);
    
    //NEWCODE +
    //identify here the wordversion (new txt variable)
    WordVersion := wrdApp.Version;
    //NEWCODE -
    
    .
    .
    .
    
    ParamInt := 7; // 7 = HTML
    
    //NEWCODE +
    //wrdDoc.MailMerge.OpenDataSource2000(MergeFileName,ParamInt);
    case Wordversion of
      '9.0':
        wrdDoc.MailMerge.OpenDataSource(MergeFileName,ParamInt);
      
      'here other older versions':
      
      else
        wrdDoc.MailMerge.OpenDataSource2000(MergeFileName,ParamInt);
    end;
    //NEWCODE -
    
    
    FileName := Attachment.ConstFilename;
    wrdDoc.SaveAs2000(FileName);  //May be, here you must do the same
    wrdDoc.ActiveWindow.Caption := WordCaption;
    wrdDoc.Saved := TRUE;
    

    Regards
    Do you make it right, it works too!
  • rajpalrajpal Member Posts: 10
    Hey Garak....

    Thanks very much for comprehensive explanation.

    Well, I did a work around for it.

    I installed MS Office 2003, and then compiled the object. It worked. Once, modified from my pc (with Office 2003) I compiled and saved the CU.

    After that, if any calls from the form made to that particular CU 5054, it works perfectly.

    Thanks once again.
Sign In or Register to comment.