|
-
November 18th, 2004, 10:07 PM
#1
Vb.net- Excel
Hi all,
In my project, I'm trying to connect Excel from VB.net thru Automation. I am able to create, add, save and close the application.
But my problem is when i try to save it opens up a dialog box as" A file named 'c:\Book1.xls' already exists in this lication. Do you want to replace it?"...... I found that it because of my coding, wb.saveas("filename")...so i try to put wb.save...But it give some error message.
What can I do? Can anybody help me? Thanks in advance
-
November 18th, 2004, 10:41 PM
#2
Re: Vb.net- Excel
in the excel application object, try setting the DisplayAlerts proerty to false.
or better yet, check to see if the file exists already (File.Exists(filename)) and if it does, remove it or display your own message.
-
November 19th, 2004, 01:28 AM
#3
Re: Vb.net- Excel
Hi,
Thanks for your reply.
Actually, when i try to click the save button each and every time it ask me the question "Do you want to replace the existing file?" etc., which i really dont want (i dont want to alert the user with my own message also). I like to show a msgbox as "Data saved", after the save process finished.
I've tried your reply....making displayalert to false...but it is not working...
anyother way !!!! Please let me know....
Regards,
Hems
-
November 19th, 2004, 08:24 AM
#4
Re: Vb.net- Excel
This problem typically occurs when a SavefileDialog is used in addition to the "saveas" command. The savefiledialog saves the file once. That is why when you have saveas command an existing file is overwritten. There must be two save commands in your coding. Otherwise it would not happen.
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
|