在此上下文中无法访问System.data.range,因为它是朋友

时间:2014-09-11 18:52:22

标签: c# vb.net

我的网页上有以下代码。我在我的参考

中有程序集Microsoft.Office.Interop.Excel
 Sub Main()
' Create new Application.
Dim excel As Application = New Application

' Open Excel spreadsheet.
Dim w As Workbook = excel.Workbooks.Open("C:\file.xls")

' Loop over all sheets.
For i As Integer = 1 To w.Sheets.Count

    ' Get sheet.
    Dim sheet As Worksheet = w.Sheets(i)

    ' Get range.
    Dim r As Range = sheet.UsedRange

对于范围单词,它给出错误说" Syste.data.Range在此上下文中无法访问,因为它是朋友。

0 个答案:

没有答案