How can I make it to automatically 'rewrite' the .xlsx file I'm trying to save?

So, I have the following code to save the highscores into an excel file, it works, I only have one problem, it always asks if I want to rewrite the existing xlsx file, how can I make it to say automatically yes to it, or is there other way to save the xlsx file so it doesn't ask this question?

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

Answers


To suppress messages to the user use:

Application.DisplayAlerts = False

Use

Application.DisplayAlerts = False

but don't forget to turn them back on before you exit your procedure...

Application.DisplayAlerts = True


Need Your Help

How to show bar values with g.raphael?

javascript graph raphael

I can't seem to figure out how to add values ontop of the bars with g.raphael.

strange python issue, 'unicode' object has no attribute 'read'

python json unicode python-requests

Here is my code and does anyone have any ideas what is wrong? I open my JSON content directly by browser and it works,

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.