Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Dec 2005
    Location
    St. Paul, Minnesota, USA
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using PL/SQL to mail merge (2003 (11.5604.5606))

    We have been using PL/SQL to interface between an Oracle database and Word 97 to perform mail merges, without the user ever actually being in Word. We are testing Office 2003 for rollout and have discovered that the code no longer works. Word can find the data source and the destination document, but it does not execute the merge. Does anyone have any suggestions? The PL/SQL is below; the code fails at 'MailMergeToDoc'.



    new_file := arameter.param_cobolfile_dir||rtrim(refid)||'_'||f ilename_in||filename_ext;

    appl_id := OLE2.CREATE_OBJ('Word.Basic');
    -- OLE2.INVOKE(appl_id,'AppShow');

    --open merge date file
    arg_list := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(arg_list,arameter.param_cobolfile_dir||filename_in||'_mrg.d oc');

    OLE2.INVOKE(appl_id,'FileOpen',arg_list);
    OLE2.DESTROY_ARGLIST(arg_list);

    --open main doc
    arg_list := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(arg_list,arameter.param_next1||'ole'||filename_in||filename _ext);

    OLE2.INVOKE(appl_id,'FileOpen',arg_list);
    OLE2.DESTROY_ARGLIST(arg_list);

    OLE2.INVOKE(appl_id,'MailMergeToDoc');

    arg_list := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(arg_list,new_file);

    OLE2.INVOKE(appl_id,'FileSaveAs',arg_list);
    OLE2.INVOKE(appl_id,'FilePrint');
    OLE2.DESTROY_ARGLIST(arg_list);

    --close all files
    arg_list := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(arg_list,2);
    OLE2.INVOKE(appl_id,'FileCloseAll',arg_list);
    OLE2.DESTROY_ARGLIST(arg_list);

    MESSAGE('File saved in: '''||UPPER(new_file)||'''.');

    OLE2.RELEASE_OBJ(appl_id);

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Using PL/SQL to mail merge (2003

    Does this article help?
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Using PL/SQL to mail merge (2003 (11.5604.5606))

    In addition to Rory's suggestion, you should be aware that the Word Mail Merge feature has changed dramatically between Word 97 (and Word 2000) and Word 2002/2003. Also, it appears that you are using Word Basic in your merge rather than VBA, and legacy support for that continues to diminish. So you may want to look at a rewrite of the procedure to use Word Automation with VBA.
    Wendell

  4. #4
    New Lounger
    Join Date
    Dec 2005
    Location
    St. Paul, Minnesota, USA
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using PL/SQL to mail merge (2003 (11.5604.5606))

    I suspect the problem is with the old code, but we've not been able to update it to VBA successfully. The developer who wrote this routine years ago doesn't know VBA, and I don't know PL/SQL, so we're having a teensy bit of a language issue. I recorded a successful merge for him using his data sources, but even when we substitute the code it still fails at the same place. Any further thoughts?

  5. #5
    New Lounger
    Join Date
    Dec 2005
    Location
    St. Paul, Minnesota, USA
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using PL/SQL to mail merge (2003

    I've just re-read this and it sounds promising. I'll have my developer try it again. Thanks, Rory.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •