所以,我有以下代码将高分保存到一个excel文件中,它可以工作,我只有一个问题,它总是问我是否要重写现有的xlsx文件,我怎样才能让它自动对它说是,还是有其他方法可以保存 xlsx 文件,所以它不会问这个问题?
Imports EXC = Microsoft.Office.Interop.Excel
Private Sub highscoreSave()
Dim app As EXC.Application
Dim ws As EXC.Worksheet, wb As EXC.Workbook
app = New EXC.Application()
app.Visible = False
wb = app.Workbooks.Open(My.Application.Info.DirectoryPath.ToString & "\highscore.xlsx")
ws = wb.Worksheets(1)
For index As Integer = 1 To 11
ws.Cells(index, 1).Value = lst_name(index - 1)
ws.Cells(index, 2).Value = lst_score(index - 1)
Next
wb.Save()
wb.Close()
app.Quit()
End Sub