F
fish_funny
I used the following source code in VB to update excel file WB01.xls in its workbook 'WB'
Horriblely, i got a updated file with double size. Even more when i open the updated fil
in Excel, i got the following error message
The struction at 0x3004c518 referenced memory at 0xfffffffc. The memory could not be read
Is there anybody have any idea about this issue. Any commnet will be highly appreciated
Thanks
Fis
'******************************************************************
Dim m_oCnnExcel As New ADODB.Connectio
Dim m_oRsExcel As New ADODB.Recordse
Private Sub Command1_Click(
If OpenExcelRecordset("C:\MyWorkSpace\Projects\BVIU\WB01.xls", "WB") = True The
m_oRsExcel.MoveNex
m_oRsExcel.Fields(0).Value = "01
m_oRsExcel.Fields(1).Value = "ABCDE-Uking
m_oRsExcel.Updat
End I
m_oRsExcel.Clos
m_oCnnExcel.Clos
End Su
Public Function OpenExcelConnection(p_sExcelFile As String) As Boolea
On Error GoTo Err_Handle
If m_oCnnExcel.State = 0 The
With m_oCnnExce
.Provider = "Microsoft.Jet.OLEDB.4.0
.Properties("Extended Properties").Value = "Excel 8.0; HDR=No
.Open p_sExcelFil
End Wit
End I
OpenExcelConnection = Tru
Exit Functio
Err_Handler
MsgBox Err.Description, vbCritica
End Functio
Public Function OpenExcelRecordset(p_sExcelFile As String, p_sExcelSheet As String) As Boolea
Dim sSQL As Strin
On Error GoTo Err_Handle
OpenExcelRecordset = Fals
If m_oRsExcel.State = 0 The
If Not OpenExcelConnection(p_sExcelFile) Then Exit Functio
sSQL = "Select * from " & "[" & p_sExcelSheet & "$]
m_oRsExcel.Open sSQL, m_oCnnExcel, adOpenDynamic, adLockOptimisti
End I
OpenExcelRecordset = Tru
Exit Functio
Err_Handler
MsgBox Err.Description, vbCritica
End Functio
Horriblely, i got a updated file with double size. Even more when i open the updated fil
in Excel, i got the following error message
The struction at 0x3004c518 referenced memory at 0xfffffffc. The memory could not be read
Is there anybody have any idea about this issue. Any commnet will be highly appreciated
Thanks
Fis
'******************************************************************
Dim m_oCnnExcel As New ADODB.Connectio
Dim m_oRsExcel As New ADODB.Recordse
Private Sub Command1_Click(
If OpenExcelRecordset("C:\MyWorkSpace\Projects\BVIU\WB01.xls", "WB") = True The
m_oRsExcel.MoveNex
m_oRsExcel.Fields(0).Value = "01
m_oRsExcel.Fields(1).Value = "ABCDE-Uking
m_oRsExcel.Updat
End I
m_oRsExcel.Clos
m_oCnnExcel.Clos
End Su
Public Function OpenExcelConnection(p_sExcelFile As String) As Boolea
On Error GoTo Err_Handle
If m_oCnnExcel.State = 0 The
With m_oCnnExce
.Provider = "Microsoft.Jet.OLEDB.4.0
.Properties("Extended Properties").Value = "Excel 8.0; HDR=No
.Open p_sExcelFil
End Wit
End I
OpenExcelConnection = Tru
Exit Functio
Err_Handler
MsgBox Err.Description, vbCritica
End Functio
Public Function OpenExcelRecordset(p_sExcelFile As String, p_sExcelSheet As String) As Boolea
Dim sSQL As Strin
On Error GoTo Err_Handle
OpenExcelRecordset = Fals
If m_oRsExcel.State = 0 The
If Not OpenExcelConnection(p_sExcelFile) Then Exit Functio
sSQL = "Select * from " & "[" & p_sExcelSheet & "$]
m_oRsExcel.Open sSQL, m_oCnnExcel, adOpenDynamic, adLockOptimisti
End I
OpenExcelRecordset = Tru
Exit Functio
Err_Handler
MsgBox Err.Description, vbCritica
End Functio