你不能创建ActiveX组件vb.net?

时间:2016-09-14 10:31:56

标签: c# asp.net vb.net excel-vba activexobject

我有一个代码来获取我的web proyect中的目录的excel文件,然后打开文件以获取数据并将其显示在我的页面中:

   Imports System.Globalization
    Imports Microsoft.Office.Interop
    Imports Microsoft.Office.Interop.Excel

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

try

  Dim oExcel As Application = CType(CreateObject("Excel.Application"), Excel.Application)
            'm_Excel = CType(CreateObject("Excel.Application"), Excel.Application)
            Dim ruta As String = System.Web.HttpContext.Current.Server.MapPath("~/excel/excel1.xlsx")

            Dim oBook As Workbook = oExcel.Workbooks.Open(ruta, , False)
            Dim oSheet As Worksheet
            oSheet = oBook.Worksheets("Sheet1")
            ........ and more code
 Catch ex As Exception
Throw ex
     End Try
  End Sub

当我在本地执行它时工作正常,但当我将proyect添加到我本地电脑的IIS中时,我收到此错误消息:

You can not create the ActiveX component

我尝试了很多东西,但我还没有得到解决方案。 :-( 有人可以知道如何解决它吗? 非常感谢您的帮助

0 个答案:

没有答案