By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,990 Members | 2,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,990 IT Pros & Developers. It's quick & easy.

No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))

P: 1
I have a peculiar issue with a single user who is using a small application I created with VB.NET (VS 2010). The issue is only seen on his machine and it used to work before...The application is currently working fine for everyone else. The only change is that he recently upgraded from MS Office 2003 to 2010...this may offer a clue, but I have not been able to find a solution.

What the app does (in a nutshell):
Searches on our network for specific Excel files, then uses the ADODB CopyFromRecordset to get the values from specific cell(s) out of those files and copies them into an Excel workbook under it's control.

While the app is running on his machine, everything runs normally except that for pretty much all the files that it would normally copy values from it throws the exception message:
Expand|Select|Wrap|Line Numbers
  1. "No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))"
  2.  
Here is a snippet of the Try...Catch routines where the exception happens:
Expand|Select|Wrap|Line Numbers
  1. Try
  2.                             My.Application.DoEvents()
  3.                             intBATFileCount = intBATFileCount + 1
  4.                             lblFilesProcessed.Text = "Number of files processed: " & intBATFileCount
  5.                             rtbRunningLog.AppendText("Processing file: " & strBATFile & vbLf)
  6.                             'Grab SiteID and Last Write Time 
  7.                             wsData.Range("A" & intRowDataTarget).Value = My.Computer.FileSystem.GetName(strBATFile)
  8.                             wsData.Range("B" & intRowDataTarget).Value = IO.File.GetLastWriteTime(strBATFile).ToShortDateString
  9.                             strReference = wsTranslations.Range("A" & intTranslationsRefRow).Value
  10.  
  11.                             'Open ADO Connection to Excel file and leave it open until all data is extracted.
  12.                             Dim ADOConnection As New ADODB.Connection
  13.                             stCon = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & strBATFile & ";" & "Extended Properties='Excel 8.0;HDR=No'"
  14.                             ADOConnection.ConnectionString = stCon
  15.                             ADOConnection.Open()
  16.                             Do Until strReference = ""                  'Do until no more data to extract from currently connected file.             
  17.                                 My.Application.DoEvents()
  18.                                 'CONVERT INTEGER TO CHARACTER
  19.                                 ' If 1-26, then this is an easy conversion 
  20.                                 If intColDataTarget < 27 Then
  21.                                     strGetExcelColumn = Chr(intColDataTarget + 64)
  22.                                 Else
  23.                                     ' Now we have to account for AA-ZZ 
  24.                                     iBeg = intColDataTarget \ 26     ' Get the first letter 
  25.                                     iEnd = intColDataTarget Mod 26   ' Get the second letter 
  26.                                     If iEnd = 0 Then
  27.                                         ' If iEnd is 0, then it is Z, which should be 26 
  28.                                         iEnd = 26
  29.                                         '** you need to subtract 1 from the initial letter otherwise your lettering will be the next letter in the alphabet
  30.                                         iBeg = iBeg - 1
  31.                                     End If
  32.                                     strGetExcelColumn = Chr(iBeg + 64) & Chr(iEnd + 64)
  33.                                 End If
  34.  
  35.                                 'Define the SQL string, call the command executer, and paste the recordset into the data sheet...but leave connection open!!!
  36.                                 stSQL = "SELECT * From [" & strReference & "]"
  37.                                 SQL_ExtractData(ADOConnection, stSQL, rst)
  38.                                 wsData.Range(strGetExcelColumn & intRowDataTarget).CopyFromRecordset(rst)
  39.                                 stSQL = Nothing
  40.                                 ADOCommand = Nothing
  41.                                 rst.Close()
  42.  
  43.                                 intTranslationsRefRow = intTranslationsRefRow + 1
  44.                                 intColDataTarget = intColDataTarget + 1
  45.                                 strReference = wsTranslations.Range("A" & intTranslationsRefRow).Value
  46.                             Loop
  47.                             ADOConnection = Nothing
  48.                         Catch err As Exception
  49.                             'Routine to save error details to "Errors" tab in the sheet
  50.                             wsErrors.Range("A" & intErrRowIndex.ToString).Value = My.Computer.FileSystem.GetName(strBATFile).ToString
  51.                             wsErrors.Range("B" & intErrRowIndex.ToString).Value = IO.File.GetAttributes(strBATFile).ToString
  52.                             wsErrors.Range("C" & intErrRowIndex.ToString).Value = err.Message.ToString
  53.                             wsErrors.Range("D" & intErrRowIndex.ToString).Value = err.Data.ToString
  54.                             intBATFileErrorCount = intBATFileErrorCount + 1
  55.                             intRowDataTarget = intRowDataTarget - 1
  56.                             intBATFileCount = intBATFileCount - 1
  57.                             lblErrors.Text = "Number of Errors: " & intBATFileErrorCount
  58.                             intErrRowIndex = intErrRowIndex + 1
  59.                         End Try
  60.  
and the SQL_Extract Subroutine that is being called...
Expand|Select|Wrap|Line Numbers
  1.     Public Sub SQL_ExtractData(ByVal ADOConnection As ADODB.Connection, ByVal stSQL As String, ByRef rst As ADODB.Recordset)
  2.         Dim ADOCommand As New ADODB.Command
  3.         ADOCommand.CommandType = ADODB.CommandTypeEnum.adCmdText
  4.         ADOCommand.ActiveConnection = ADOConnection
  5.         ADOCommand.CommandText = stSQL
  6.         rst = ADOCommand.Execute()
  7.     End Sub
  8.  
Now I know that the connection to Excel (from VB.NET app) is fine because it's actually writing the exception error details into the sheet I reserved for errors. What's throwing me for a loop is why it cannot copy the record from the sheet on the network into that Excel file? Something to do with a missing/corrupt library on the users machine? Something to do with his new version of Excel? (Note: Other users use Excel 2010 with no issues)

Any help or insight would be appreciated as I am a "self-taught" programmer...even just discussing the issue might help me think about a solution even if you cannot offer one.

Thank you!!!

-Derek
Mar 9 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.