Word macro from Forms

How can I start a macro in Word from Forms with the DDE-package? For Excel I use this command ('update' is the macro-name):
DDE.Execute(ConvID, [run "'test.xls!update"]', 10000);
Does anybody know the right approach for a Word macro?
Thanks.
null

You should use OLE2 instead of DDE.
Use this procedure if you're using Word version >= 97:
PROCEDURE RUN_MACRO(cMacroName VARCHAR2) IS
objWordApp OLE2.OBJ_TYPE := OLE2.CREATE_OBJ('WORD.APPLICATION');
objArgList OLE2.LIST_TYPE := OLE2.CREATE_ARGLIST;
BEGIN
OLE2.ADD_ARG(objArgList,cMacroName);
OLE2.INVOKE(objWordApp,'Run',objArgList);
OLE2.DESTROY_ARGLIST(objArgList);
OLE2.INVOKE(objWordApp,'QUIT');
OLE2.RELEASE_OBJ(objWordApp);
END;
you can contact me for further explanation.
Carlos

Similar Messages

  • How to open word doc. from forms 10g

    hi all
    i am trying to open word doc. from forms 10g using ole2.
    but it is not working.
    basiccaly this command is not working
    app := CLIENT_OLE2.CREATE_OBJ('Word.Application');
    can anybody help
    thanx

    I found this searching this forum and it works..however, my issue is to open up Microsoft Word passing in data from a query.
    I am working on Forms 10g
    DECLARE AppID PLS_INTEGER;
    BEGIN
    AppID := DDE.App_Begin('C:\Program Files\Microsoft Office\OFFICE11\winword.exe C:\test.doc',
    DDE.APP_MODE_NORMAL);
    END;

  • Create/Edit Word documents from Form 6 in the web

    How can I create/edit Microsoft Word documents from a form running under IAS.
    In client/server I can do it using OLE2.

    On the Web the OLE2 option would still work if your Forms server is on a windows machine with word on it. The files will be created on the server and you can get them to the client with the web.show_document built-in.
    If you want to create them on the client machine directly you need a Java bean that will activate the COM interface.

  • Open Word Doc from form in web setting not client/server

    Hello, I am new to form. I need to open a word doc (on client PC )from Oracle Form by a button click. I did some research online and looks like Client_Ole2 is the package I need. But when I looked into my Build-in Package (in forms builder), I only see OLE2, TEXT_IO etc. So when I try to declare a variable which is CLIENT_OLE2 like some post suggest, I got error message "identifier CLIENT_OLE2.OBJ_TYPE must be declared".
    So is that means that I need to install/setup WebUtil on my env to get this Client_Ole2 to show up on Form Builder?
    Thanks for help, please advise.

    I found the way to add webutil.pll to attached Libraries.This is the wrong way. Open the webutil.olb in the Forms Builder. Then open your form you want to add the Object Library too. In the Object Libraries node of the Object Navigator - double-click on the WEBUTIL node. This will open the Object Library properties window. Click on and drag the WEBUTIL entry to the Object Groups node of your Form. You will be prompted "Do you want to copy the object or subclass it?" Click on the Subclass button.
    Subclassing is a Forms method that allows you to share a single source of an object/code between multiple Forms. It is Forms' way of implementing inheritance.
    I also copied them to /forms/java directory too.This is not necessary. I recommend you delete the files you copied to the /forms/java directory. Forms will find the libraries if the .../forms directory is listed in your FORMS_PATH environment variable (see the default.env file). The /DevSuiteHome/forms directory should be the first directory listed in the FORMS_PATH variable.
    Remove path?". So I selected Yes. But when I run form, I got FRM_40039: Cannot attach library webutil while opening form ......".The fact that you are getting this error indicates that the /forms directory is NOT part of the FORMS_PATH.
    If I choose No to keep the hard code path, then if I deploy the form to testing server or production server, it will become problem! Right? How to solve this?Double-check to ensure it is listed. The variable entry should look something like:
    FORMS_PATH=D:\DevSuiteHome_1\forms;<any other directories you want to be part of your path seperated by ";">Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • How can add or open  a document like word,excel  from forms ?

    Hello,
    I want to open a excel file from my forms from a specific location , i have to write the code in when-button-pressed button i.e when i will click on add button it will open a dialog box there i need to browse the excel file then it will add the link in my form, when i click on that link it will open the excel file .
    Many Thanks.

    hi
    do u use webutil? if yes then try something like this.
    when-button-pressed trigger
    declare
          f varchar2(100);
    begin
         f := webutil_file.file_open_dialog();
         if f is not null then
              :excel.file_name := f;
              end if;
         end;Note:- u have to attach webutil.pll without webutil it will not work.
    sarah

  • Best way to access Word doc from Forms 6i

    We have a requirement whereby the user can press a button on the form, and this starts up Word and opens a document. The user can update the doc, and save it, and on exiting Word, control returns to the form.
    I know that we can use DDE for this, but I don't want to do that.
    We want to restrict access to this Word document to only those people who have access to the form. I was thing about actually holdinh the word document in the database.
    What would people recommend?
    Is it better to use LOBS/BLOBS etc?
    Or should I be using iFS? What are the benefits of each?
    Many thanks in advance.
    Harry
    null

    i use openssh tunnel for x11vnc, then tightvnc at work (plus ssh in windows) to access, see the x11vnc wiki for info, i followed the info on this page for the ssh tunneling.
    Last edited by toxygen (2010-02-11 08:08:30)

  • Open word document from oracle forms 10g

    Hi,
    Could any one please guide me how to open a word document from forms 10g on client machine (windows). My word document resides on application server (unix).
    Thanks for the help in advance.

    I tried that, but it doesn't work.
    What I have done is, I have written a java code that has a function ope_word that opens up a word document. I have created jar out of it called wordbean.jar.
    Add this wordbean.jar in $ORACLE_HOME/forms/java directory and also added in the formsweb.cfg file (archive_jini=wordbean.jar)
    Then I created a form and usinf fbean.register and fbean.invoke functions of forms, I am trying to call wordbean.jar.
    F.bean.register is registering all the components of wordbean.jar but it is not opening the word document.
    Could you please help ??

  • Bookmark from Forms 11g

    Hello Seniors,
    I want to call microsoft word with all bookmark from forms 10g. (we have Visual basic application with word template ,all word template have bookmark and we want to call all bookmark directly from forms 10g).
    I am able to call microsoft word template from forms 10g. But i dont know how to pass value in that bookmark.
    i.e in visual basic we select employee id from application and its pass same value in template bookmark but how to pass emp id from forms 10g so that it pass value in template and all the bookmark saws value in it.).
    Its huge application so we dont want to write all the code again ,thats why we want to directly call word template/bookmark from forms 10g.
    Please advice ,
    Thanks!

    Sorry Francois
    I added as you advice but nothing comes up . if you don't mind would you please guide me where i have to define those bookmark. please find my code ,pls correct if it is wrong.
    Appreciate your help .
    PROCEDURE Open_Doc
    IS
    -- Open a stored document --
    LC$Cmd Varchar2(128) ; -- command to be run in Windows
    LC$Nom Varchar2(100) ;
    LC$Fic Varchar2(128);
    LC$Path Varchar2(128);
    LC$Sep Varchar2(1) ;
    LN$But Pls_Integer ;
    LB$Ok Boolean ;
    FType VARCHAR2(20); -- File Type (Extension)
    CType VARCHAR2(128); -- Command Type (in Windows)
    -- Current Process ID --
    ret WEBUTIL_HOST.PROCESS_ID ;
    Begin
         -- Local temporary file name --
         LC$Sep := '\'; -- you can use WEBUTIL_FILE.Get_File_Separator ;
    --     LC$Nom := Substr( :BIN_DOCS.Name, instr( :BIN_DOCS.Name, LC$Sep, -1 ) + 1, 100 ) ;
         LC$Nom :=:WMS_QUEUE_TASKS.TASK_NAME;
    --message(LC$Nom);
         LC$Path := 'C:\Temp'; -- use standard DOS dir -- can use CLIENT_WIN_API_ENVIRONMENT.Get_Temp_Directory ;
         -- File Path with File name in Windows
         LC$Fic := LC$Path || LC$Sep || LC$Nom;
         LC$Fic :=LC$Fic ||'#CAN';
    --message('File info '||LC$Fic);
    -- File extension
    FType := SUBSTR(:WMS_QUEUE_TASKS.COMMAND_LINE_PARM,INSTR(:WMS_QUEUE_TASKS.COMMAND_LINE_PARM,'.') + 1, 4);
    -- Based on File extension will assign Windows Command
    CType := NULL; -- by default command in Windows is NULL - taken Windows default
    -- Default Command is NOT working for WINWORD
    IF UPPER(FType) IN ('DOC','DOTM','DOTX') THEN
    CType := 'WINWORD /W';
    END IF;
         -- File extraction --
    IF NOT PKG_TRANSFERTS.DB_To_Client
    LC$Fic,
    'WMS_QUEUE_TASKS',
    'DOC',
    'DOC_ID = ' || To_Char( :WMS_QUEUE_TASKS.Doc_ID )
    ) THEN
    Set_Alert_Property( 'AL_ERROR', TITLE, 'DB to Client' ) ;
    Set_Alert_Property( 'AL_ERROR', ALERT_MESSAGE_TEXT, 'Error transfering local file' ) ;
    LN$But := Show_Alert( 'AL_ERROR' ) ;
    Raise Form_trigger_Failure ;
    ELSE
    Message('Transferred to Client');
    END IF ;
    -- this command will be run from Windows
    LC$Cmd := 'cmd /c start "My script" /WAIT '|| CType||' "'||LC$Fic ||'" ';
    --message ('Host command: '||LC$Cmd);
         Ret := WEBUTIL_HOST.blocking( LC$Cmd ) ;
         LN$But := WEBUTIL_HOST.Get_return_Code( Ret ) ;
         IF LN$But <> 0 Then
              Set_Alert_Property( 'AL_ERROR', TITLE, 'Host() command' ) ;
    Set_Alert_Property( 'AL_ERROR', ALERT_MESSAGE_TEXT, 'Host() command error : ' || To_Char( LN$But ) ) ;
    LN$But := Show_Alert( 'AL_ERROR' ) ;
    LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
    Raise Form_Trigger_Failure ;
         END IF;
         -- Re-store the modified file in the database --
    IF NOT PKG_TRANSFERTS.Client_To_DB
    LC$Fic,
    'WMS_QUEUE_TASKS',
    'DOC',
    'DOC_ID = ' || To_Char( :WMS_QUEUE_TASKS.Doc_ID )
    ) Then
    Set_Alert_Property( 'AL_ERROR', TITLE, 'Client to DB' ) ;
    Set_Alert_Property( 'AL_ERROR', ALERT_MESSAGE_TEXT, 'Error on storing file' ) ;
    LN$But := Show_Alert( 'AL_ERROR' ) ;
    Raise Form_trigger_Failure ;
    ELSE
         -- The changes are commited to Database --> Build better interface
         COMMIT;
         Clear_Message ;
         Message('File re-stored in the database /Commited', no_acknowledge ) ;      
    END IF ;     
    -- Remove the temporary local file --
         LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
         IF LB$Ok = FALSE Then
              Bell ;
              Message( 'Error removing local file ', no_acknowledge ) ;
         END IF;
         Clear_Message ;
    Exception
              When Form_Trigger_Failure Then
              Raise ;
    End Open_Doc ;

  • How to point at a word table using forms  Ole and Word Document

    Hello.
    I like to know how to position at a word table and send data from a forms module using ole. I have done something similar before using bookmarks.It's easy and it works. My requirement now is to send data from a forms module to a word document, but this time, the word document will have bookmarks and a word table needs to be filled from data from the database. Just don't know how to get , access, reference the word table from forms.
    I'm still using forms6i in C/S mode.
    Help will be greatly appreciated ...!.
    Best regards, Luis ...!

    Hi Luis,
    The VBA code for updating the cell found at row three, column two of the first table, of the active document is as follows:
       ActiveDocument.Tables(1).Cell(3,2).Select
       Selection.TypeText("Hello, world!")I haven't time to convert it to OLE2, but hopefully it will at least give you an idea.
    Eric Adamson
    Lansing, Michigan

  • Launch Microsoft Word macro with an applet

    Hi,
    I've got the following problem :
    First, I'd like to generate a .txt file (from an applet) on the client PC with informations (name, address...)
    Second, I'd like to lauch word macro from the applet and to merge informations from the .txt file with the .doc.
    Is it possible to do that ?
    Is it the best solution ? (the goal of the application is to generate letter to send to client)
    Thank You
    Sophie

    You can do it via Applet Servlet Communication.

  • WRITE MACRO FOR WORD IN ORACLE FORMS 6I

    Dear All
    I want to know the coding to write a macro for word document to print , when i open the word document using ole2. I am able to open word, insert the header and footer but i want to print the document also. Since I dont want to write the macro in word file because i have lot of files , so whenever the user run the form i just want to take print . Is there any way.
    V.S

    V.S.,
    I suggest you open a Word document and record a macro that prints a document. Then edit the macro and you will see all of the commands that were issued to print the document. Then try to emulate these commands in your OLE calls from Forms.
    I tried searching the internet for a comprehensive list of OLE commands, but never found anything. Through trial and error, I discovered if I open the application and recorded a macro to perform that action I want (in this case - printing a Word document) - I could edit the macro and see the commands used by the application to perform the action. Then base your Form OLE code on the macro. ;-)
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Calling Word document from Oracle Forms 10g

    Hi all,
    I would like to call a Microsoft Word document from my Oracle Forms 10g.
    What would be the best way to do this?
    Thank you in advance.

    Have you tried something like
    WEB.SHOW_DOCUMENT('file:///<documentpath>','_blank');

  • Shifting of data from forms to word (arabic)

    In one of our ongoing project we need to pass some data from forms to
    word document , in some cases the Shifting of data takes Place mostprobably when we used / character . The Format of data in Arabic and English .
    example:-
    T C 3/5
    get shifted into T C 5/3
    character . the data in arabic and english.
    Any conclusion.
    Regards

    hi
    do u have any Idea abou calling a Function Module (F.M)..
    1.The form interface in the smart form do the same as Functionmodule interface..
    2.when u r running the Smartfrom means u need to send some data to the smartforms and u will get some return parameters... this form interfaces do the same...i) Import tab in form interface is used give some inputs to the form
              ii) Export tab in form interface is used return some inf Form Smartform to Calling Program.
            iii) the Table tab is used to send the Internal table data.
    3.retriving data form Database table... u can achive this in two ways..
          i) selectin data in drivere program or calling program and send that to Smart forms.
      ii) selecting the data in the smartforms... you can write the code in GLOBAL DIFINATIONS-->INITIALIZATIONS tab.. Note:!!! when u want to use intenal tables or variables in initialization tab.. u have to pass them in INPUT AND OUTPUT PARAMETERS of the INITIALIZATION tab.
    Please Close this thread.. when u r problem is solved
    Reward if Helpful
    Regards
    Naresh Reddy K

  • Producing a WORD document from RoboHelp

    Hi,
    I am trying to produce a WORD document from RoboHelp using the Single Source Layout. The Output View says," Waiitng for Project Documentation VBA macros to be registered." I then receive an error message stating that WORD is not responding.
    How do I resolve this issue? Thank you in advance for your feedback.
    okaye

    Hi there
    Sorry, but my crystal ball is broken again so I can't tell what version or flavor of RoboHelp you are using. Nor am I able to discern what version of Word is on your system.
    Can you help us out a tad and tell us this info?
    Thanks... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 moments from now - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcererStone Blog
    RoboHelp eBooks

  • Call Word Macro by using OLE2

    Hi,
    I use oracle forms 6i to call a word macro by using OLE2 .
    The macro called 'MyMacro' cannot be run and view although
    I can run it calling from MS Word seperatly.
    Code Below and No Errors running;
    DECLARE
    -- Declare the OLE objects
    MyApplication OLE2.OBJ_TYPE;
    MyDocuments OLE2.OBJ_TYPE;
    MyDocument OLE2.OBJ_TYPE;
    -- Declare handle to the OLE argument list
    args OLE2.LIST_TYPE;
    BEGIN
    -- Create the Word.Application object and make Word visible
    -- by setting the 'Visible' property to true
    MyApplication:=OLE2.CREATE_OBJ('Word.Application');
    OLE2.SET_PROPERTY(MyApplication, 'Visible', 1);
    -- get a handle on Documents collection
    MyDocuments:=OLE2.GET_OBJ_PROPERTY(MyApplication, 'Documents');
    -- Open a document doc.doc in C:\
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, 'C:\RAPOR\example.DOC');
    Mydocument :=OLE2.INVOKE_OBJ(MyDocuments,'Open',args);
    OLE2.DESTROY_ARGLIST(args);
    -- Execute the macro called 'MyMacro'
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, 'MyMacro');
    OLE2.INVOKE(MyApplication,'Run',args);
    OLE2.DESTROY_ARGLIST(args);
    OLE2.RELEASE_OBJ(MyDocument);
    OLE2.RELEASE_OBJ(MyDocuments);
    OLE2.RELEASE_OBJ(MyApplication);
    END;
    ------- code ends here-----
    Thanks.

    Hello. Try :
    myapplication := ole2.create_obj ('Word.Application');
    ole2.set_property (myapplication, 'Visible', 1);
    mydocuments := ole2.get_obj_property (myapplication, 'Documents');
    args := ole2.create_arglist;
    ole2.add_arg (args, :aux.nome_arquivo);
    mydocument := ole2.invoke_obj (mydocuments, 'Open', args);
    ole2.destroy_arglist (args);
    args := ole2.create_arglist;
    ole2.add_arg (args, 'maximize'); -- your macro
    ole2.invoke (myapplication, 'Run', args);
    ole2.destroy_arglist (args);
    args := ole2.create_arglist;
    ole2.add_arg (args, 'organize'); -- your macro
    ole2.invoke (myapplication, 'Run', args);
    ole2.destroy_arglist (args);
    args := ole2.create_arglist;
    ole2.add_arg (args, 'print'); -- your macro
    ole2.invoke (myapplication, 'Run', args);
    ole2.destroy_arglist (args);
    args := ole2.create_arglist;
    ole2.add_arg (args, 'Fechar');
    ole2.invoke (myapplication, 'Run', args);
    ole2.destroy_arglist (args);
    args := ole2.create_arglist;
    ole2.Release_obj (mydocument);
    ole2.Release_obj (mydocuments);
    ole2.Release_obj (myapplication); -- if dont need close application then coment this line

Maybe you are looking for