ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   excel saving exception in vc code (https://www.excelbanter.com/excel-discussion-misc-queries/156876-excel-saving-exception-vc-code.html)

onlyfang

excel saving exception in vc code
 
I save a excel file using vc code, when the file is aready exsited, a
dialogue box appears with three choices--yes, no or cancel--for me to decide
whether to cover the exsited file or not. If I choose yes, it runs well. But
when I choose ¡°no¡± or ¡°cancel¡±, an exception happens--a messagebox
without any words appeares and the excel file doesn¡¯t exit.

Why does this happen? Can anyone help me?



Dave Peterson

excel saving exception in vc code
 
Do you always want to save the file?

Application.displayalerts = false
'your code to save the workbook
application.displayalerts = true



onlyfang wrote:

I save a excel file using vc code, when the file is aready exsited, a
dialogue box appears with three choices--yes, no or cancel--for me to decide
whether to cover the exsited file or not. If I choose yes, it runs well. But
when I choose ¡°no¡± or ¡°cancel¡±, an exception happens--a messagebox
without any words appeares and the excel file doesn¡¯t exit.

Why does this happen? Can anyone help me?


--

Dave Peterson

Dave Peterson

excel saving exception in vc code
 
ps. I don't speak the VC code. You'll have to interpret it.

Dave Peterson wrote:

Do you always want to save the file?

Application.displayalerts = false
'your code to save the workbook
application.displayalerts = true

onlyfang wrote:

I save a excel file using vc code, when the file is aready exsited, a
dialogue box appears with three choices--yes, no or cancel--for me to decide
whether to cover the exsited file or not. If I choose yes, it runs well. But
when I choose ¡°no¡± or ¡°cancel¡±, an exception happens--a messagebox
without any words appeares and the excel file doesn¡¯t exit.

Why does this happen? Can anyone help me?


--

Dave Peterson


--

Dave Peterson

onlyfang

excel saving exception in vc code
 
Oh, thank you very much, Dave! The problem has been solved!
Yes, i always want to save the file, and the counterpart code in vc is
"Application.SetDisplayAlerts(false)".
Thank you!

"Dave Peterson"
...
ps. I don't speak the VC code. You'll have to interpret it.

Dave Peterson wrote:

Do you always want to save the file?

Application.displayalerts = false
'your code to save the workbook
application.displayalerts = true

onlyfang wrote:

I save a excel file using vc code, when the file is aready exsited, a
dialogue box appears with three choices--yes, no or cancel--for me to
decide
whether to cover the exsited file or not. If I choose yes, it runs
well. But
when I choose ¡°no¡± or ¡°cancel¡±, an exception happens--a messagebox
without any words appeares and the excel file doesn¡¯t exit.

Why does this happen? Can anyone help me?


--

Dave Peterson


--

Dave Peterson





All times are GMT +1. The time now is 02:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com