Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8798631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:08:21+00:00 2026-06-14T00:08:21+00:00

Hello i’m trying to import data from an excel to visual basic variables, but

  • 0

Hello i’m trying to import data from an excel to visual basic variables, but im getting an strange error. I did add the reference to microsoft excel com library.

Imports Microsoft.Office.Interop.Excel

Module Module1

Sub Main()
    ExtraerCostos()
End Sub

Public Sub ExtraerCostos()

    Dim numero As String
    Dim aux As String
    Dim costos(20) As Double
    Dim cant As Integer  

    Dim excelApp As New Microsoft.Office.Interop.Excel.Application
    Dim workbook As New Microsoft.Office.Interop.Excel.Workbook ' The error points to this line 
    Dim sheet As New Microsoft.Office.Interop.Excel.Worksheet

    excelApp = CreateObject("Excel.Application")
    excelApp.Visible = True
    workbook = excelApp.Workbooks.Open("C:\workbook.xls")
    sheet = workbook.Worksheets("Factura Detallada")

     'Irrelevant code
    numero = "111111111"
    cant = 12

    While numero.Length = 9
        cant = cant + 1
    End While

    For i = 12 To cant

        numero = sheet.Cells(i, 1).text
        For j = 3 To 22
            aux = sheet.Cells(i, j).text
            If aux = "-" Then
                costos(j - 2) = 0
            Else : costos(j - 2) = Convert.ToDouble(aux)

            End If
            Console.WriteLine(costos(j - 2))
        Next


    Next

End Sub
End Module

Retrieving the COM class factory for component with CLSID {00020819-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:08:22+00:00Added an answer on June 14, 2026 at 12:08 am

    you can’t create a workbook or worksheet in this way.
    you have to use the Workbooks.Open or Workbooks.Add method (you do that in line 10 of ExtraerCostos)

    use

    Dim workbook as Excel.Workbook

    and already was okay

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello i need to gater the data from db(MSSQL) in following way: <div id=slider>
Hello Guys I am trying to figure out why i am gettings this error
Hello guys I am seeking help when it comes to getting text from an
Hello I did login as a super admin in the front en of joomla
Hello! I've been programming for a long time but just started developing for android,
Hello All I am trying to flatten a list in Ocaml. I am a
Hello I call static PageMethod from JS. PageMethod send some information to emails. When
Hello I'm making RSS reader and I'm using DOM. Now I stuck, trying to
Hello There, I am new to phonegap.I am trying to record a audio clip
. Hello, I am trying to add a UIButton and other items to my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.