我有一些要写给excel的值,但是没有写。奇怪的是,如果我读取单元格并在MsgBox中显示该值,则会显示该值。因此该值在单元格中,但不是因为它为空。
Dim xlApp As New Application
Dim xlBook As Workbook = xlApp.Workbooks.Add()
Dim xlSheet As Worksheet = CType(xlBook.ActiveSheet, Worksheet)
Dim xlRange As Range = xlSheet.Range("A1")
xlRange.Value = "Starting...."
-----
-----
xlSheet.Range("A3").Value = AuthToken.ToString()
MsgBox("In Cell A3 you have written: " & xlSheet.Range("A3").Value)
有什么想法吗?
改进
我设法使其正常运行,但是解决方案并不是最佳解决方案,我不想每次都想使用With时使用...
With xlSheet
Range("A1").Value = "Starting"
Range("A2").Value = Token
End With