Esta indicando CRAXDRT.Application is not define
CRAXDRT.Report is not define
Já pesquisei muito e não consegui descobrir o correspondente.
Agradeço a ajuda
Segue abaixo o código
Public crxAplicacao As New CRAXDRT.Application
Public crxRelatorio As New CRAXDRT.Report
Public Enum eObjetoRPT
formula
Parametro
texto
End Enum
Public Sub RptCampo(ByRef crxRel As CRAXDRT.Report, ByVal strNomeCampo As String, ByVal strTextoOuValorDoCampo As String, Optional ByVal Tipo As eObjetoRPT = eObjetoRPT.formula, Optional ByVal strSecao As String = "")
'se o campo é uma fórmula, strTextoOuValorDoCampo deve ser o texto da fórmula
'se o campo é um parâmetro, strTextoOuValorDoCampo deve ser o valor do parâmetro
Dim n As Integer
On Error GoTo hError
If Tipo = eObjetoRPT.formula Then
'corrige problema com o caracter "'"
If Left(strTextoOuValorDoCampo, 1) = "'" Then strTextoOuValorDoCampo = Mid(strTextoOuValorDoCampo, 2, Len(strTextoOuValorDoCampo) - 1)
strTextoOuValorDoCampo = Replace(strTextoOuValorDoCampo, "'", "''")
If Left(strTextoOuValorDoCampo, 1) <> "'" Then strTextoOuValorDoCampo = "'" & strTextoOuValorDoCampo & "'"
For n = 1 To crxRel.FormulaFields.Count
If UCase$(crxRel.FormulaFields(n).FormulaFieldName) = UCase$(strNomeCampo) Then
If crxRel.FormulaFields(n).ValueType = crStringField Then
crxRel.FormulaFields(n).Text = strTextoOuValorDoCampo
Else
crxRel.FormulaFields(n).Text = CInt(Replace(strTextoOuValorDoCampo, "'", ""))
End If
Exit For
End If
Next n
ElseIf Tipo = eObjetoRPT.Parametro Then
For n = 1 To crxRel.ParameterFields.Count
If UCase$(crxRel.ParameterFields(n).ParameterFieldName) = UCase$(strNomeCampo) Then
crxRel.ParameterFields(n).ClearCurrentValueAndRange()
Select Case crxRel.ParameterFields(n).ValueType
Case crNumberField
crxRel.ParameterFields(n).AddCurrentValue(CLng(strTextoOuValorDoCampo))
Case crCurrencyField
crxRel.ParameterFields(n).AddCurrentValue(CCur(strTextoOuValorDoCampo))
Case crDateField, crDateTimeField, crTimeField
crxRel.ParameterFields(n).AddCurrentValue(CDate(strTextoOuValorDoCampo))
Case crBooleanField
crxRel.ParameterFields(n).AddCurrentValue(CBool(strTextoOuValorDoCampo))
Case Else
crxRel.ParameterFields(n).AddCurrentValue(strTextoOuValorDoCampo)
End Select
Exit For
End If
Next n
ElseIf Tipo = eObjetoRPT.texto Then
Dim Objeto As Object
If strSecao = "" Then Exit Sub
For Each Objeto In crxRel.Sections.Item(strSecao).ReportObjects
If Objeto.Kind = crTextObject Then
If UCase(Trim(Objeto.Text)) = UCase(strNomeCampo) Then
Objeto.SetText(strTextoOuValorDoCampo)
Exit For
End If
End If
Next Objeto
End If
End Sub