Page 1 of 1

OLE Object Error ( Argument error )

Posted: Thu Oct 14, 2010 2:54 pm
by marco_malac
Hi people,

I'm using a simple function of OLE instructions for msoutlook (2007), but one of this instructions ( the same of sample ) has something wrong, this message was showed after the line be processed. the compilation is OK.
If somebody have any tip i'll apreciate very much

this is the error message :

Error WINOLE/1007 Argument error:DISPLAY (DOS Error1)

This is my function :

STATIC PROCEDURE OUTLOOKSuporte()

LOCAL oOL, oList, oMail, i, LM

oOL := CreateObject( "Outlook.Application" , "localhost" )
oList := oOL:CreateItem( 0 )

SELE PAR
LM := PAR->WORKF1
oList:to := PAR->WORKF1

SELE SUP
oList:Subject := "Registro de Suporte - GCLIQ"
oList:body := 'Prezado(s),'+ chr(13)+chr(13) + ;
oList:Display(.F.) <=== Error Line
oList:Send()

RETURN

Re: OLE Object Error ( Argument error )

Posted: Wed Dec 01, 2010 7:19 pm
by RalphMDS
Hi Marco,

I was running into the same problem as you and couldn't find a solution so I ended up working around the problem like this:

1) In the body of my form I added an Activex control as follows:

DEFINE ACTIVEX Activex_1
ROW 365
COL 39
WIDTH 0
HEIGHT 0
PROGID "shell.explorer.2"
END ACTIVEX

Note that the row and the column don't matter and that the height and width are set to 0 as we don't want the user to see what is going on here.

2) Next I use a function like the following to invoke Outlook:

FUNCTION SendEmail(cemail)

LOCAL oIE

oIE := main.Activex_1.Object
oIE:Navigate( 'mailto:'+trim(cemail) )

RETURN Nil

So far, this has been working well for my application.

Best regards,

Ralph