Click here to Skip to main content
15,882,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends , I am using below mentioned code to convert excel file as CSV through VB code. When I run the application & upload the file , system shows message of "Do you wan to save changes on file". I don't want this message to be displayed to my end user.

Please guide.

What I have tried:

Dim xlsApp As New Excel.Application
        Dim xlsWorkBook As Excel.Workbook
        Dim xlsWorkSheet As Excel.Worksheet
        xlsApp = New Excel.Application
        xlsWorkBook = xlsApp.Workbooks.Open(excelPath)
        xlsWorkSheet = xlsWorkBook.Worksheets(1) ' You could also do it by name: "sheet1"
        xlsWorkBook.SaveAs(csvPath, FileFormat:=Excel.XlFileFormat.xlCSV, CreateBackup:=False)
Updated 7-Apr-20 2:50am
Richard MacCutchan 7-Apr-20 8:47am    
If there is no option on SaveAs to suppress the message then there is nothing much you can do about it.

With VBA, I used to surround my code with:
Application.DisplayAlerts = False
' My code
Application.DisplayAlerts = True
Share this answer
Hemil Gandhi 7-Apr-20 13:33pm    
Thanks, Solution Worked
Patrice T 7-Apr-20 15:54pm    
You're welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900