问题描述
我在工作室2015中使用VB.net和框架4.5,但我无法选择工作表,请任何人帮忙。
Sofare我的代码看起来像这样,但是选择的woorksheet不起作用?
进口Microsoft.Office.Interop.Excel
昏暗excelApp As _Application = New Application
Dim wb As _Workbook = excelApp.Workbooks.Open(C:\ Client.xlsm;)
Dim ws As Worksheet = wb.Sheets(Log - Jysk Vagt)
excelApp.Visible = True
excelApp.ScreenUpdating = True
我尝试过:
Imports Microsoft.Office.Interop.Excel
Dim excelApp As _Application = New Application
Dim wb As _Workbook = excelApp。 Workbooks.Open(C:\ Client.xlsm;;)
Dim ws As Worksheet = wb.Sheets(Log - Jysk Vagt)
excelApp.Visible = True
excelApp.ScreenUpdating = True
I using VB.net in studio 2015 with framework 4.5 but I cant select a worksheet, please anyone help.
Sofare my code look like this, but the selection of the woorksheet don't work?
Imports Microsoft.Office.Interop.Excel
Dim excelApp As _Application = New Application
Dim wb As _Workbook = excelApp.Workbooks.Open("C:\Client.xlsm";)
Dim ws As Worksheet = wb.Sheets("Log - Jysk Vagt")
excelApp.Visible = True
excelApp.ScreenUpdating = True
What I have tried:
Imports Microsoft.Office.Interop.Excel
Dim excelApp As _Application = New Application
Dim wb As _Workbook = excelApp.Workbooks.Open("C:\Client.xlsm";)
Dim ws As Worksheet = wb.Sheets("Log - Jysk Vagt")
excelApp.Visible = True
excelApp.ScreenUpdating = True
推荐答案
Dim ws As Worksheet = CType(wb.Sheets("Log - Jysk Vagt"), Worksheet)
它适用于我
这篇关于如何使用框架4.5在VB.NET中使用EXCEL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!