Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP OLE CLASS with errors
Message
 
To
30/05/2012 14:23:33
Victor Chignes
Inteliventas
Peru
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Miscellaneous
Thread ID:
01544802
Message ID:
01544814
Views:
33
Try this:
Define Class bIRexGenerador As Session OlePublic

DataSession = 2 && Private Session

PROCEDURE Generar

PARAMETERS formatfile, outputfile,lclosefile,lsaveConfig,lAllowUserInteraction
	SET DELETED ON
	SET safety off
	SET EXCLUSIVE OFF
	CLOSE ALL

	runId=SYS(2015)
	logId=0
	#include EXCEL.H
	[code]
	
ENDPROC
		
FUNCTION logs(x)
	IF !ISNULL(oErr) AND TYPE("oErr") = "O" 
           IF !hayError
		ErrorEncontrado = "Error"+STR(oErr.ErrorNo)+[  LineNo: ] + STR(oErr.LineNo) +[  Message: ] +;
                                  oErr.Message +[  Procedure: ] + oErr.Procedure +[  Details: ] + oErr.Details +;
                                         [ StackLevel: ] + STR(oErr.StackLevel) +[ LineContents: ] + oErr.LineContents +;
                                         [  UserValue: ] + oErr.UserValue 
	    ENDIF
         ELSE
	    IF !hayError    
	       ErrorEncontrado =""
	    ENDIF
	 ENDIF
         INSERT INTO log VALUES (x, DATETIME(), fcRow,"Demo", formatfile, outputfile, ErrorEncontrado,RunId,LogId)
	logId=LogId+1
	hayError=.F.
RETURN .t.


FUNCTION GetSheet
	LPARAMETERS wbName,oXcel
	Encontrado=.f.
	FOR i=1 TO oXCEL.worksheets.Count
		IF UPPER(oXcel.worksheets(i).Name) = UPPER(wbName)
			Encontrado=.T.
			RETURN oXcel.worksheets(i)
		ENDIF
	ENDFOR
	oXcel.worksheets.ADD
	xlSheet = oXcel.activesheet
	xlSheet.NAME = wbName

	RETURN xlSheet 
ENDfunc

FUNCTION valor
	LPARAMETERS x
	retval=""
	IF !ISNULL(x)
		DO case
			CASE TYPE("x")="C"
				retval=x
			CASE TYPE("x")="N"
				retval=STR(x)
		ENDCASE
	ENDIF
	RETURN retval
ENDfunc

PROCEDURE Error(nError, cMethod, nLine)
	hayError=.t.
	ErrorEncontrado =  'error #' + transform( nError ) + ': "' + message() + '"' + 'program:  ' +;
                            Program(-1) + 'line #' + transform( nLine ) + ":  " + message(1)
	=this.logs(errorencontrado)
	RETURN
ENDPROC

ENDDEFINE
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform