PDA

View Full Version : [SOLVED:] Showing a dialog box during saving



Regouin
05-11-2005, 01:50 AM
Hello everyone,

And yet I have another problem. I have a workbook which completely hides excel and only uses it in the background (so not viewable to the user). I have a button labeled close on the menu and I want it to save and quit. Well the save and quit part is easy, but here is the trick. While saving I want a dialog box to appear which tells the user that the program is busy saving (to prevent the user from starting to press buttons because the user thinks that the program stopped responding, saving takes a considerable amount of time). Now at the moment I got it worked out like this:



Option explicit

Private Sub cmdafsluit_Click()
dialogbox.Show
Unload Me
Application.Quit
End Sub


and then the code for 'dialogbox'



Option Explicit

Private Sub UserForm_activate()
ActiveWorkbook.save
Unload Me
End Sub


Now it does show the userform while saving, but the text on the userform doesnt appear when it is done activating (and since it never reaches that point, the text never gets shown). Now is there a way to work around this, remember that I only want a box to appear whilst the computer is saving, nothing more, nothing less. I just used a userform because I thought that might work, but unfortunately it didnt work out the way i wanted it to.

TIA
Frank

Steiner
05-11-2005, 01:55 AM
Try a DoEvents as the first command in UserForm_activate to give Excel the time to paint the form before it goes on.

Regouin
05-11-2005, 01:59 AM
can you please elaborate on that, I dont quite get what you mean with a DoEvents as the first command. Just put DoEvents as the first line in activate?

tia

Regouin
05-11-2005, 02:00 AM
ok never mind, figured it out, works beautifully, sometimes the solution is so simple :P