|
-
Mar 8th, 2004, 08:57 AM
#1
Thread Starter
Member
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
-
Mar 8th, 2004, 09:23 AM
#2
Thread Starter
Member
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
-
Mar 8th, 2004, 09:30 AM
#3
Hyperactive Member
You are closing excel in your program?
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Mar 8th, 2004, 09:37 AM
#4
Thread Starter
Member
yes, after writing the data into the excelsheet, i want to exit vb. net, and excel
-
Mar 8th, 2004, 09:40 AM
#5
Hyperactive Member
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!
Last edited by mudfish; Mar 8th, 2004 at 09:45 AM.
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Mar 8th, 2004, 09:46 AM
#6
Thread Starter
Member
i dont' know,
how could i change it to invisible
-
Mar 8th, 2004, 09:54 AM
#7
Hyperactive Member
found this in help
xlSheet.Application.Visible = True ' Show the application.
search " Excel.Worksheet"
I have .net 1
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Mar 8th, 2004, 09:58 AM
#8
Thread Starter
Member
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
-
Mar 8th, 2004, 10:00 AM
#9
Hyperactive Member
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.
Last edited by mudfish; Mar 8th, 2004 at 10:05 AM.
Mudfish AKA Bowfin
I can spell "If" all day right, just a coder!
"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway
Member of the ECCC

-
Mar 8th, 2004, 10:10 AM
#10
Thread Starter
Member
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
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
|