RE: Problem to see specific Data in Excel Cell via VB6
From: NIL (NIL_at_discussions.microsoft.com)
Date: 10/23/04
- Next message: NIL: "RE: Can anybody show me how to open up a DAO connection to an Access d"
- Previous message: NIL: "RE: VB.Net (ADO): Thoughts on Copying 7 tables to 1 table"
- In reply to: eranRL: "Problem to see specific Data in Excel Cell via VB6"
- Next in thread: Daniel Crichton: "Re: Problem to see specific Data in Excel Cell via VB6"
- Messages sorted by: [ date ] [ thread ]
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.
>
- Next message: NIL: "RE: Can anybody show me how to open up a DAO connection to an Access d"
- Previous message: NIL: "RE: VB.Net (ADO): Thoughts on Copying 7 tables to 1 table"
- In reply to: eranRL: "Problem to see specific Data in Excel Cell via VB6"
- Next in thread: Daniel Crichton: "Re: Problem to see specific Data in Excel Cell via VB6"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|