Web アプリ フォルダーにある Excel ワークブックを開くと、セルを読み進めると、作業していた以前の Excel スプレッドシートの値が表示されます。これはキャッシュの問題でしょうか?
Dim xlApp As Excel.Application = Nothing
Dim xlWorkBook As Excel.Workbook = Nothing
Dim xlWorkSheet As Excel.Worksheet = Nothing
Dim misValue As Object = System.Reflection.Missing.Value
Dim strCell2 As String = ""
xlApp = New Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Open("book1.xlsx")
xlWorkSheet = xlWorkBook.Worksheets("sheet1")
Dim strOutput As String = ""
Dim cell As Excel.Range
Dim i As Integer = 1
For Each cell In xlWorkSheet.Range("B:B")
strCell2 = xlWorkSheet.Cells(i, 2).value
If strCell2 <> Nothing Then
strCell2 = xlWorkSheet.Cells(i, 2).value ' value here is of a different workbook
i = i + 1
Else
Exit For
End If
Next
「ソリューション エクスプローラー」に Excel スプレッドシートが表示され、クリックすると正しいワークブックが開きます。混乱.com。
これを開く前に、メモリまたはキャッシュをクリアする必要がありますか?