Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

run-time error '2147417851' (80010105')  method of  'open' of object 'workbooks' failed

Posted on 2008-10-01
5
Medium Priority
?
4,381 Views
Last Modified: 2013-11-25
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.filesystemobject")
    SelExcelFileName = Trim(ctlSELEXECLFILENAME.Text)
    If Trim(Len(SelExcelFileName)) = 0 Then
       MsgBox "Select Excel file", vbCritical, Me.Caption
       cmdFILESEARCH.SetFocus
       Exit Sub
    End If
'**********************************************************************
    If Not fs.FileExists(SelExcelFileName) 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.Text))) = 0 Then
       ctlEXCELNO.Text = "0"
    End If
'**********************************************************************
    If Trim(Len(Trim(ctlEXECLHEADER.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
0
Comment
Question by:nitin_s_shah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 85

Assisted Solution

by:Rory Archibald
Rory Archibald earned 400 total points
ID: 22612962
Your path does not appear to point to a template or add-in so whay are you using the Editable argument? (the True bit)
0
 

Author Comment

by:nitin_s_shah
ID: 22613026
it is working fine till yesterday but suddenly it is giving error
0
 
LVL 16

Assisted Solution

by:JohnBPrice
JohnBPrice earned 1600 total points
ID: 22613753
>>it is working fine till yesterday but suddenly it is giving error

The error code is "Server threw an exception", e.g. meaningless.  Can you open the file normally with Excel?  Save it and try again?
0
 

Author Comment

by:nitin_s_shah
ID: 22621393
i am able to open with normal excel and save it also. i have installed all component again but same result.
0
 
LVL 16

Accepted Solution

by:
JohnBPrice earned 1600 total points
ID: 22627636
Make sure Excel is not running (if your app ever crashed or otherwise didn't properly ask Excel to quit, it will still be running forever.  Close it with Task Manager.  Step through your program to double check that SelExcelFileName is still correct (copy it and paste inot a run bar to ensure you don't have a "doh!" kind of error.)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question