Falla automatizacin Excel

Buen da

Tengo el siguiente cdigo que funcionaba bien, aumente un grfico dinmico en la plantilla excel y comenz a dar problemas, quite el grfico, creen otra plantilla, pero sigo teniendo el mismo error “Failed on value”, el error se da en la celda “C3”, el campo R.Field(“codigo_seccion”).StringValue tiene un valor “1C4”, si comento la entrada de la celda “C3”, me da error en otra celda, la programacin no a cambiado, la plantilla esta bien, los datos son los mismo, cual puede ser el problema?

Saludos.
Mauricio

dim pg As PostgreSQLPreparedStatement = db.Prepare(“select * From depreciacion_periodo_fnc($1, $2, $3, $4)”)
dim r as RecordSet = pg.SQLSelect(“A”, “V”, 201501, 201701)

Dim Excel as new ExcelApplication
Dim oworkbook As ExcelWorkbook
Dim osheet As ExcelSheets
oworkbook = excel.Workbooks.Add(“C:\temp\platillas\depreciacion_perido.xltx”)
osheet = Excel.Sheets(“Datos”)

dim RangoA, RangoB, RangoC, RangoD, RangoE, RangoF, RangoG, RangoH As String

for i As Integer = 2 To r.RecordCount + 1
RangoA = “A” + i.ToText
RangoB = “B” + i.ToText
RangoC = “C” + i.ToText
RangoD = “D” + i.ToText
RangoE = “E” + i.ToText
RangoF = “F” + i.ToText
RangoG = “G” + i.ToText
RangoH = “H” + i.ToText

Excel.Range(RangoA).Value = R.Field("grupo").StringValue
Excel.Range(RangoB).Value = R.Field("grupo_nombre").StringValue
Excel.Range(RangoC).Value = R.Field("codigo_seccion").StringValue
Excel.Range(RangoD).Value = R.Field("nombre_seccion").StringValue
Excel.Range(RangoE).Value = R.Field("activo").StringValue
Excel.Range(RangoF).Value = R.Field("activo_nombre").StringValue
Excel.Range(RangoG).Value = R.Field("periodo").IntegerValue
Excel.Range(RangoH).Value = R.Field("depreciacion").DoubleValue

r.MoveNext 

next

dim RangoTotal As String
RangoTotal = “=Datos!$A$1:$H$” + str(r.RecordCount + 1)

Excel.ActiveWorkbook.Names.Add(“data”, RangoTotal)

Excel.Visible = True
db.Close

Exception err As OLEException

db.Close
MsgBox err.Message

Buen da.

Al parecer Xojo y sus Plugins no se llevan bien con Kaspersky, lo detecto como virus, toca notificar a Kaspersky el problema.

Saludos
Mauricio