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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using insert function with Oleobject

Status
Not open for further replies.

sonujain25

Programmer
Jan 23, 2008
3
0
0
hi all,
Can anybody tell me if in Powerbuilder 6 we can use insert function with oleobject.
i have code, error occured OLEMailMerge.insert( lAddress ) line. not any comiplation error is occured but at run time error is occured.
plz Help me and thanks in advance

Any lResult
Long lTotRows,i,j,ret
String lAddress
// Declare and create ole object.
OLEObject OLEMailMerge
OLEMailMerge = CREATE OLEObject
lResult = OLEMailMerge.ConnectToNewObject( "word.basic" )
If Integer(lResult) <> 0 Then
DESTROY OLEMailMerge
MessageBox( "Error in connecting to Word for Windows", "Error Code: " + String( lResult ) )
Return
End If
lTotRows = dw_1.Rowcount()
For i = 1 to lTotRows Step 1
lAddress = dw_1.GetItemString(i,1)
// For j = 2 to 7 Step 1
// lAddress = lAddress + "~r~n" + &
// dw_1.GetItemString(i,j)
// Next
Messagebox("add",lAddress)
ClipBoard( lAddress )
lResult = OLEMailMerge.FileOpen("C:\doc\ole_letter.doc")
If Integer(lResult) <> 0 Then
DESTROY OLEMailMerge
MessageBox("Error in connecting to Word " + &
"for Windows", "Error Code: " + String( lResult ) )
Return
End If
Messagebox("lResult",string(lResult))
// These are the important commands:
OLEMailMerge.editgoto( "Address" )
OLEMailMerge.insert( lAddress )
//ret = OLEMailMerge.Selection.typetext( lAddress )
// Messagebox("Ret",string(ret))
OLEMailMerge.FilePrint()
OLEMailMerge.FileClose( 2 )
Next
lResult = OLEMailMerge.DisConnectObject()
DESTROY OLEMailMerge
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top