VB.NET Excel运行.XLA文件

时间:2022-01-04 13:53:09

I had the following code.

我有以下代码。

I am trying to call EntFunc2.xla and load it into the Excel1.xls but it seems like not successful. May I know how can I really run the xla file in my Excel directly through VB.NET codes?

我试图调用EntFunc2.xla并将其加载到Excel1.xls但它似乎不成功。我可以知道如何通过VB.NET代码直接在Excel中运行xla文件?

   Dim xlApp As Excel.Application = Nothing
   Dim xlWorkBooks As Excel.Workbooks = Nothing
   Dim xlWorkBook As Excel.Workbook = Nothing
   Dim xlCells As Excel.Range = Nothing
   xlApp = New Excel.Application
   xlApp.DisplayAlerts = False
   xlWorkBooks = xlApp.Workbooks
   xlWorkBook = xlWorkBooks.Open("C:\Excel1.xls")
   xlApp.Visible = True
   xlApp.Run("P:\MASTER\EntFunc2.xla")

1 个解决方案

#1


0  

Just open the XLA as if it was an ordinary workbook

只需打开XLA就好像它是一个普通的工作簿

xlWorkbooks.Open("P:\MASTER\EntFunc2.xla")

#1


0  

Just open the XLA as if it was an ordinary workbook

只需打开XLA就好像它是一个普通的工作簿

xlWorkbooks.Open("P:\MASTER\EntFunc2.xla")