Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open Word document with OLE control

Status
Not open for further replies.

rarara

Programmer
Jan 19, 2004
2
BE
Hi,

I want to open mutiple Word documents after selecting the documents in a PB application.
first i select a Blob object from the database :
blob lbl_doc
SELECTBLOB word_document INTO :lbl_doc
FROM harmony_document_template
where template_code = :as_template_code and the_language = :ls_language;
ole_1.ObjectData = lbl_doc
ole_1.Activate(OffSite!)
ole_1.Object.application.ActiveDocument.Add_Ref()
Add_Ref() ==> is a function in the VBA code of the document
if I do this code in a loop then he opens all the documents,
but he overwrites each time the documents
so i can only see the last document in Word

How can I open these documents and not overwritting the previous ones
So I can choose in "window" between the documents

thanks,



 
Here goes an example: ( u should look up CONNECTTONEWOBJECT )

Regards.



datastore lds_control, lds_detalle

integer li_resultado
long ll_fila = 10, ll_total, i, j, ll_totdet
string ls_ente, ls_monant, ls_moneda

OLEObject lobjExcel
lobjExcel = CREATE OLEObject
li_resultado = lobjExcel.ConnectToNewObject( "excel.application")
if li_resultado <> 0 then goto fallo

lobjExcel.WorkBooks.Add

lobjExcel.Columns(&quot;E:E&quot;).ColumnWidth = 15
lobjExcel.Columns(&quot;F:F&quot;).ColumnWidth = 30
lobjExcel.Columns(&quot;G:G&quot;).ColumnWidth = 14

lds_control = create datastore
lds_control.dataobject = &quot;ds_ba_autorizacion_de_pago&quot;
lds_control.settransobject(sqlca)

lds_detalle = create datastore
lds_detalle .dataobject = &quot;ds_ba_autorizacion_de_pago_det&quot;
lds_detalle .settransobject(sqlca)

ll_total = lds_control.retrieve(as_empresa, as_ente)
for i = 1 to ll_total
ls_ente = lds_control.getitemstring(i, &quot;cod_ente&quot;)
lobjExcel.Activesheet.Cells(ll_fila, 2).Value = lds_control.getitemstring(i, &quot;nom_cliente&quot;)

ll_totdet = lds_detalle.retrieve(as_empresa, ls_ente, gnvuo_sesion.event eu_obtener_oficina(), gnvuo_sesion.event eu_obtener_usuario(), &quot;9&quot;, adt_inicio, adt_final )
for j = 1 to ll_totdet
ll_fila ++
if j <> 1 then
ls_monant = ls_moneda
end if
ls_moneda = lds_detalle.getitemstring(j , &quot;des_moneda&quot;)

if ls_moneda <> ls_monant then
lobjExcel.Activesheet.Cells(ll_fila, 3).Value = &quot;Moneda&quot;
lobjExcel.Activesheet.Cells(ll_fila, 4).Value = ls_moneda
ll_fila ++
lobjExcel.Activesheet.Cells(ll_fila, 3).Value = &quot;Cuenta&quot;
lobjExcel.Activesheet.Cells(ll_fila, 4).Value = &quot;No Cheque&quot;
lobjExcel.Activesheet.Cells(ll_fila, 5).Value = &quot;Fec.Impresión&quot;
lobjExcel.Activesheet.Cells(ll_fila, 6).Value = &quot;Beneficiario&quot;
lobjExcel.Activesheet.Cells(ll_fila, 7).Value = &quot;Mto Cheque&quot;
//lobjExcel.Activesheet.Cells(ll_fila, 7).Style = &quot;Currency&quot;
//lobjExcel.Activesheet.Cells(ll_fila, 7).NumberFormat = &quot;#,##0.00&quot;


The life is too short to cry and long enough to try it... God bless us.
[thumbsup2]
 
thank you for your quick answer
but.............
i can't work with a OLEobject because i have to open a BLOB
and with a OLEobject you cann't open a blob !
blob lbl_doc
SELECTBLOB word_document INTO :lbl_doc
FROM harmony_document_template
where template_code = :as_template_code and the_language = :ls_language;
so.............i'm still searching.......
HELP !!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top