-
Saving To Excel
Hi all,
Dim xl As New Object
Dim wb As Excel.Workbook
Dim sh As Excel.Worksheet
xl = CreateObject("excel.application")
wb = xl.Workbooks.Open("c:\file.xls")
sh = wb.Worksheets(1)
sh.Name = "Bench-Marking DATABASE"
With sh
.Cells(2, 1).Value = "T"
.Cells(2, 2).Value = "D"
.Cells(2, 3).Value = "L"
.Cells(2, 4).Value = "T"
.Cells(2, 5).Value = "A"
.Cells(2, 6).Value = "C"
End With
wb.save()
i managed to save the file, but i always get this pop up window asking me to whether to save the file or not,
is there a way i can do it, wihout having to see the small window.
take care
-
sorry that was bit vague,
what i am trying to do, is to read and write back to EXCEL.
but i want to save file automatically, without having to deal with the pop window asking user whether to save or not.....
anyway to do that..
thank you very much
-
You are closing excel in your program?
-
yes, after writing the data into the excelsheet, i want to exit vb. net, and excel
-
You shell excell and add data to a spread sheet that is stored?
Do you have excell set to be visible?
You can make it not visible!
I am not a good . net person yet I see if I can find the command in .net!
-
i dont' know,
how could i change it to invisible
-
found this in help
xlSheet.Application.Visible = True ' Show the application.
search " Excel.Worksheet"
I have .net 1
-
i am still gettting the pop window to ask me whether i want to save the file or not,,,,,
id ont' know what to do,,,
thank you very much
-
In the save command there should be away to tell excell to save and close, let me look some more in help!
From help
Example
This example uses the CreateObject function to set a reference (xlApp) to Microsoft Excel. It uses the reference to access the Visible property of Microsoft Excel, and then uses the Microsoft Excel Quit method to close it. Finally, the reference itself is released.
-
i think i've cracked it
i've used this mate :
wb.close savechanged:=true
wb is the workbook
thank you very much for helping
take care
god bless