RE: Problem to see specific Data in Excel Cell via VB6

From: NIL (NIL_at_discussions.microsoft.com)
Date: 10/23/04


Date: Sat, 23 Oct 2004 09:45:03 -0700


you are only reading the cell.value. there is another property, the text
property, which you should also look into. You need to determine the type of
data the cell is holding, you cells could be holding text data.

"eranRL" wrote:

> Hello all,
>
> I have a very wierd problem.
>
> I have an Excel file, that looks normaly
>
> I have data in the cells. that I can see while activate the
> Excell Program, can manipulate that data... like Cut paste ac..
>
> But when I go into my VB project..
> Some of the Cells I see as a NULL value..
> Can somebody help me, do you have an Idea how can that happend????/
>
> This is the code and attach is the Excell file.
> The file is Excell2000. Maybe I open the File incorrect in VB..?
> Maybe Do you have some triks that I can do?
>
> When I use the Record Count I see all Records.
> When I go on F3 some of the Data apears as NULL
>
> Thanks in Adnvace
> Eran.
>
> Here is the Code:
>
> Public Function fOpen_ConnDBExcelFrmActive()
> 'Connect to the Excel DB
> 'Created by Rinat Sade - iDnext Ltd.
>
> On Error GoTo function_error
>
> Dim objData As New CDBData
> Dim pszConnection As String
> Dim pszDataBase As String
> Set objCn = New ADODB.Connection
> If objCn.State = adStateOpen Then
> If objRs.status = 1 Then
> objRs.Close
> Set objRs = Nothing
> End If
> objCn.Close
> End If
>
> Dim glTheError As Long
>
> 'get string connection
> 'Paste the correct Excel File here !!
> pszDataBase = frmActiveForm.txtExcelFile.Text
> 'glTheError = objData.fGetDBConnection(11, pszDataBase, "")
> pszConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> "Data Source=" & pszDataBase & _
> "; Extended Properties=""Excel 8.0;HDR=No;"""
>
> 'Open connection
> objCn.Open pszConnection
>
> Set objData = Nothing
>
> Dim pszString As String
> Set objRs = New ADODB.Recordset
>
> If objRs.State = adStateOpen Then
> objRs.Close
> End If
>
>
> objRs.CursorType = adOpenStatic
> ' Use client cursor to allow use of
> ' AbsolutePosition property.
> objRs.CursorLocation = adUseClient
>
>
> ' Open the recordset
> pszString = "[" & frmActiveForm.txtTable.Text & "]"
>
> objRs.Open pszString, objCn, adOpenStatic, adLockOptimistic
> Debug.Print "Number of Records : "; objRs.RecordCount
> objRs.MoveFirst
> Do While Not objRs.EOF
> Debug.Print objRs.Fields("f3").Value
> objRs.MoveNext
> Loop
>
> Exit Function
> function_error:
> Debug.Print err.Description, err.Number
> End Function
>
> --
> Eran Harel
> R & D Manager
> iDnext Ltd.
>



Relevant Pages

  • Re: dynamically building template columns
    ... // apply custom formatting to data cells ... it's SortExpression to an empty string. ... Dim bfield As TemplateField = New TemplateField ... Private _templateType As ListItemType ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • RE: Error Trap not working
    ... Dim ColACount as Integer ... Dim ColAAddress As String, ColAName As String, ColBRange as String ... 'Code here that names the range of cells in Col. B as ColBRange ...
    (microsoft.public.excel.programming)
  • RE: Error Trap not working
    ... "Steve C" wrote: ... Dim ColAAddress As String, ColAName As String, ColBRange as String ... 'Code here that names the range of cells in Col. B as ColBRange ...
    (microsoft.public.excel.programming)
  • Re: convert a Word macro to an Excel macro
    ... specified column that contain specified text. ... once these cells are ... Dim myCell As Range ... Public Function ExtractDuration(InputString As String) As String ...
    (microsoft.public.excel.programming)
  • Re: Find string in Data
    ... possible to process the data from its source rather than putting it in cells ... Dim Contents As String ... Dim Fields() As String ...
    (microsoft.public.excel.programming)