|
-
Apr 10th, 2004, 02:52 AM
#1
Thread Starter
Junior Member
Excel in VB.Net
I am trying to disable the "Save Changes" dialog
Here is the code I am using, everything works but I still get the "Save Changes" dialog.
Private Sub btApply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btApply.Click
Dim WSheet
Dim FN As String
Dim sv As New SaveFileDialog
sv.CreatePrompt = False
sv.OverwritePrompt = False
FN = "C:\WS 2000 Simulator\Data\Data.xls"
EXL.Workbooks.Open(FN)
WSheet = EXL.Workbooks.Item(1).Worksheets("Sheet1")
With WSheet
.Cells(4, 3).Value = txtSystemName.Text
.Cells(5, 3).Value = txtSystemLocation.Text
.Cells(6, 3).Value = txtAdminEMail.Text
.Cells(7, 3).Value = cbCountry.Text
.Cells(8, 3).Value = lblWS2000Version.Text
End With
EXL.Workbooks.Close()
End Sub
Thanks for any help
-
Apr 10th, 2004, 04:56 AM
#2
Fanatic Member
is there any property as SetWarning or Warning?? If yes, try to set it False
-
Apr 10th, 2004, 12:31 PM
#3
Thread Starter
Junior Member
Not that I could find, I get the same pop up window that you would get if you changed an Excel spreadsheet and just tried to close it without saving it first.
-
Apr 10th, 2004, 05:04 PM
#4
Thread Starter
Junior Member
Solved
Got it, here is the modified code for anyone elce trying to do the samething.
This will open an Excel spreadsheet, modify it, then save it without the "Save Current" windows dialog.
Private Sub btApply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btApply.Click
Dim WSheet
Dim FN As String
EXL.DisplayAlerts = False
FN = "C:\WS 2000 Simulator\Data\Data.xls"
EXL.Workbooks.Open(FN)
WSheet = EXL.Workbooks.Item(1).Worksheets("Sheet1")
With WSheet
.Cells(4, 3).Value = txtSystemName.Text
.Cells(5, 3).Value = txtSystemLocation.Text
.Cells(6, 3).Value = txtAdminEMail.Text
.Cells(7, 3).Value = cbCountry.Text
.Cells(8, 3).Value = lblWS2000Version.Text
End With
EXL.SaveWorkspace()
EXL.Workbooks.Close()
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|