knowing the path of word automaticly [message #403646] |
Sun, 17 May 2009 20:08  |
mustafagamiel
Messages: 17 Registered: April 2009 Location: Egypt
|
Junior Member |
|
|
Dear all
If I want to use microsoft word I write host then the path
but if the path in another partion then the word will not work
so how can I determine automatic the path in stead of I write it
|
|
|
|
|
|
Re: knowing the path of word automaticly [message #403924 is a reply to message #403791] |
Tue, 19 May 2009 09:50   |
klat
Messages: 87 Registered: May 2009 Location: Mumbai
|
Member |

|
|
Try this
declare
app CLIENT_OLE2.OBJ_TYPE;
docs CLIENT_OLE2.OBJ_TYPE;
doc CLIENT_OLE2.OBJ_TYPE;
selection CLIENT_OLE2.OBJ_TYPE;
args CLIENT_OLE2.LIST_TYPE;
BEGIN
-- create a new document
app := OLE2.CREATE_OBJ('Word.Application');
if :ole.silent = 'Y'
then
OLE2.SET_PROPERTY(app,'Visible',0);
else
OLE2.SET_PROPERTY(app,'Visible',1);
end if;
docs := OLE2.GET_OBJ_PROPERTY(app, 'Documents');
doc := OLE2.INVOKE_OBJ(docs, 'add');
selection := OLE2.GET_OBJ_PROPERTY(app, 'Selection');
-- insert data into new document from long item
OLE2.SET_PROPERTY(selection, 'Text', :ole.oletext);
-- save document as example.tmp
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, :ole.filename);
OLE2.INVOKE(doc, 'SaveAs', args);
OLE2.DESTROY_ARGLIST(args);
-- close example.tmp
args := CLIENT_OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 0);
OLE2.INVOKE(doc, 'Close', args);
OLE2.DESTROY_ARGLIST(args);
OLE2.RELEASE_OBJ(selection);
OLE2.RELEASE_OBJ(doc);
OLE2.RELEASE_OBJ(docs);
-- exit MSWord
OLE2.INVOKE(app,'Quit');
END;
|
|
|
Re: knowing the path of word automaticly [message #403926 is a reply to message #403791] |
Tue, 19 May 2009 09:53   |
klat
Messages: 87 Registered: May 2009 Location: Mumbai
|
Member |

|
|
Try this
declare
app CLIENT_OLE2.OBJ_TYPE;
docs CLIENT_OLE2.OBJ_TYPE;
doc CLIENT_OLE2.OBJ_TYPE;
selection CLIENT_OLE2.OBJ_TYPE;
args CLIENT_OLE2.LIST_TYPE;
BEGIN
-- create a new document
app := OLE2.CREATE_OBJ('Word.Application');
if :ole.silent = 'Y'
then
OLE2.SET_PROPERTY(app,'Visible',0);
else
OLE2.SET_PROPERTY(app,'Visible',1);
end if;
docs := OLE2.GET_OBJ_PROPERTY(app, 'Documents');
doc := OLE2.INVOKE_OBJ(docs, 'add');
selection := OLE2.GET_OBJ_PROPERTY(app, 'Selection');
-- insert data into new document from long item
OLE2.SET_PROPERTY(selection, 'Text', :ole.oletext);
-- save document as example.tmp
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, :ole.filename);
OLE2.INVOKE(doc, 'SaveAs', args);
OLE2.DESTROY_ARGLIST(args);
-- close example.tmp
args := CLIENT_OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 0);
OLE2.INVOKE(doc, 'Close', args);
OLE2.DESTROY_ARGLIST(args);
OLE2.RELEASE_OBJ(selection);
OLE2.RELEASE_OBJ(doc);
OLE2.RELEASE_OBJ(docs);
-- exit MSWord
OLE2.INVOKE(app,'Quit');
END;
|
|
|
|