I am new to VB.NET. I was developing a software with related to Excel, in which I have to write and SAVE the details at appropriate columns. I am currently having a problem in saving the data.
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Open
Dim MyExcel As New Excel.Application
MyExcel.Workbooks.Open("C:\Test\WalkAir.xls")
'Extract
MyExcel.Sheets("sheet1").Activate()
MyExcel.Range("A77").Activate()
MyExcel.DisplayAlerts = False
If Form2.TextBox1.Text = "sucess" Then
MyExcel.ActiveCell.Offset(1, 0).Activate()
End If
MyExcel.ActiveCell.Value = "Test"
'Close
MyExcel.SaveWorkspace()
'MyExcel.Quit()
'MyExcel.Workbooks.Close()
'MyExcel.WriteXLS("WalkAir.xls")
MyExcel.Workbooks.Close()
MyExcel = Nothing
Me.Hide()
Form2.Show()
End Sub
End Class
Very first time I debug the coding I haven't got much problem. But debugging it again gives me an Error AS:
"A file named 'Resume.XLW' already exits in this location. Do you want to replace it?"
I was able to see this since I have enabled the display alerts. Disabling it generates a save as window.
I would be much obliged if you can really help me in this issue
Best Regards.

New Topic/Question
Reply



MultiQuote



|