Problem to see specific Data in Excel Cell via VB6
From: eranRL (eranRL_at_discussions.microsoft.com)
Date: 10/20/04
- Previous message: claire: "Recordset problems with ADO/C++"
- Next in thread: NIL: "RE: Problem to see specific Data in Excel Cell via VB6"
- Reply: NIL: "RE: Problem to see specific Data in Excel Cell via VB6"
- Reply: Daniel Crichton: "Re: Problem to see specific Data in Excel Cell via VB6"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 20 Oct 2004 09:35:04 -0700
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.
- Previous message: claire: "Recordset problems with ADO/C++"
- Next in thread: NIL: "RE: Problem to see specific Data in Excel Cell via VB6"
- Reply: NIL: "RE: Problem to see specific Data in Excel Cell via VB6"
- Reply: Daniel Crichton: "Re: Problem to see specific Data in Excel Cell via VB6"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|