Reputation:
My goal is to attempt that popping up the option to save or open the file that already been created.
Here's my code :
Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
Dim misValue As Object = System.Reflection.Missing.Value
xlApp = New Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Add(misValue)
xlWorkSheet = CType(xlWorkBook.Sheets("sheet1"), Excel.Worksheet)
xlWorkSheet.Cells(1, 1) = "PERIOD"
xlWorkSheet.Cells(1, 2) = "PARTS_NO_FG"
xlWorkSheet.Cells(1, 3) = "QTY_ASSY"
xlWorkSheet.Cells(1, 4) = "COSTING1"
xlWorkSheet.Cells(2, 1) = "201212"
xlWorkSheet.Cells(2, 2) = "01125E6041"
xlWorkSheet.Cells(2, 3) = "5"
xlWorkSheet.Cells(2, 4) = "0"
xlWorkSheet.SaveAs("D:\TemplateAssy.xlsx")
xlWorkBook.Close()
xlApp.Quit()
releaseObject(xlApp)
releaseObject(xlWorkBook)
releaseObject(xlWorkSheet)
Then how to popping up when I execute this program VB.NET thanks
Upvotes: 0
Views: 368
Reputation: 1339
Just turn on the Alerts. It should solve the problem
Application.DisplayAlerts = True
workbook.SaveAs(filePath)
Application.DisplayAlerts = True
Source: http://p2p.wrox.com/vb-how/63900-disabling-second-excel-save-prompt.html
revesed answer from shasur
EDIT : IN your case
xlApp.DisplayAlerts = True
xlWorkbook.SaveAs(filePath)
xlApp.DisplayAlerts = True
Also try xlApp.Visible = True
may be able to give you pointers on where / why its not showing up.
Upvotes: 2