Nitin Shah
asked on
run-time error '2147417851' (80010105') method of 'open' of object 'workbooks' failed
run-time error '2147417851' (80010105') method of 'open' of object 'workbooks' failed while opening excel -workshooet in vb 6 program
program coding
-----------------------
Private Sub OpenExcelDataBase()
'************************* ********** ********** ********** ********** *****
'** CONVERT DATA FROM EXCEL TO SQL DATABASE
'************************* ********** ********** ********** ********** *****
Dim fs
Set fs = CreateObject("scripting.fi lesystemob ject")
SelExcelFileName = Trim(ctlSELEXECLFILENAME.T ext)
If Trim(Len(SelExcelFileName) ) = 0 Then
MsgBox "Select Excel file", vbCritical, Me.Caption
cmdFILESEARCH.SetFocus
Exit Sub
End If
'************************* ********** ********** ********** ********** *****
If Not fs.FileExists(SelExcelFile Name) Then
MsgBox "Warning - Not a valid Excel file name ", vbCritical
Exit Sub
End If
'************************* ********** ********** ********** ********** *****
XLSBK.DefaultFilePath = SelExcelFileName
'************************* ********** ********** ********** ********** *****
XLSBK.Workbooks.Open SelExcelFileName, , , , , , , , , True ' <-----here erroe is generated---->
XLSBK.Visible = False
'************************* ********** ********** ********** ********** *****
If Trim(Len(Trim(ctlEXCELNO.T ext))) = 0 Then
ctlEXCELNO.Text = "0"
End If
'************************* ********** ********** ********** ********** *****
If Trim(Len(Trim(ctlEXECLHEAD ER.Text))) = 0 Then
ctlEXECLHEADER.Text = "0"
End If
'************************* ********** ********** ********** ********** *****
SelExcelNo = Trim(ctlEXCELNO.Text)
SelExcelHeaderNo = Trim(ctlEXECLHEADER.Text)
If SelExcelHeaderNo = 0 Then
SelExcelHeaderNo = 1
Else
SelExcelHeaderNo = SelExcelHeaderNo + 1
End If
If SelExcelNo = 0 Then
SelExcelNo = 1
Else
SelExcelNo = SelExcelNo + 1
End If
Set XLwsh = XLSBK.Sheets(SelExcelNo)
'************************* ********** ********** ********** ********** *****
vb-excel-error.bmp
program coding
-----------------------
Private Sub OpenExcelDataBase()
'*************************
'** CONVERT DATA FROM EXCEL TO SQL DATABASE
'*************************
Dim fs
Set fs = CreateObject("scripting.fi
SelExcelFileName = Trim(ctlSELEXECLFILENAME.T
If Trim(Len(SelExcelFileName)
MsgBox "Select Excel file", vbCritical, Me.Caption
cmdFILESEARCH.SetFocus
Exit Sub
End If
'*************************
If Not fs.FileExists(SelExcelFile
MsgBox "Warning - Not a valid Excel file name ", vbCritical
Exit Sub
End If
'*************************
XLSBK.DefaultFilePath = SelExcelFileName
'*************************
XLSBK.Workbooks.Open SelExcelFileName, , , , , , , , , True ' <-----here erroe is generated---->
XLSBK.Visible = False
'*************************
If Trim(Len(Trim(ctlEXCELNO.T
ctlEXCELNO.Text = "0"
End If
'*************************
If Trim(Len(Trim(ctlEXECLHEAD
ctlEXECLHEADER.Text = "0"
End If
'*************************
SelExcelNo = Trim(ctlEXCELNO.Text)
SelExcelHeaderNo = Trim(ctlEXECLHEADER.Text)
If SelExcelHeaderNo = 0 Then
SelExcelHeaderNo = 1
Else
SelExcelHeaderNo = SelExcelHeaderNo + 1
End If
If SelExcelNo = 0 Then
SelExcelNo = 1
Else
SelExcelNo = SelExcelNo + 1
End If
Set XLwsh = XLSBK.Sheets(SelExcelNo)
'*************************
vb-excel-error.bmp
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i am able to open with normal excel and save it also. i have installed all component again but same result.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER