Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default trying to get out

Have a befor close save event works fine want to if possible have a userform
show while save is going on then close workbook ie excel Tried this no go
also tried an option button on userform no go.
Would like userform7 to show while save is goung on them shut down. Hope I
made this understandable.
Thanks to all

Private Sub Workbook_BeforeClose(cancel As Boolean)
UserForm7.Show
' ThisWorkbook.Save
'UserForm7.Show
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default trying to get out

Curt,

You need to show the form as non-modal.. Give this a try:


Private Sub Workbook_BeforeClose(Cancel As Boolean)

UserForm7.Show False
DoEvents
ThisWorkbook.Save

End Sub


--
Hope that helps.

Vergel Adriano


"Curt" wrote:

Have a befor close save event works fine want to if possible have a userform
show while save is going on then close workbook ie excel Tried this no go
also tried an option button on userform no go.
Would like userform7 to show while save is goung on them shut down. Hope I
made this understandable.
Thanks to all

Private Sub Workbook_BeforeClose(cancel As Boolean)
UserForm7.Show
' ThisWorkbook.Save
'UserForm7.Show
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default trying to get out

False made the userform lose all graphics nothing but a blank whits screen.
Save worked as should. Maybe the close button on excel could trigger the form
and use the form to save and close. have never used the close x to do
something like this.
Do have the userform option button so will save and close. Am trying to have
this be seen while program closes
Thanks

"Vergel Adriano" wrote:

Curt,

You need to show the form as non-modal.. Give this a try:


Private Sub Workbook_BeforeClose(Cancel As Boolean)

UserForm7.Show False
DoEvents
ThisWorkbook.Save

End Sub


--
Hope that helps.

Vergel Adriano


"Curt" wrote:

Have a befor close save event works fine want to if possible have a userform
show while save is going on then close workbook ie excel Tried this no go
also tried an option button on userform no go.
Would like userform7 to show while save is goung on them shut down. Hope I
made this understandable.
Thanks to all

Private Sub Workbook_BeforeClose(cancel As Boolean)
UserForm7.Show
' ThisWorkbook.Save
'UserForm7.Show
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default trying to get out

The call to DoEvents should have painted the user form before initiating the
workbook save...

Another way might be to show the user form as non modal, wait for 1 or 2
seconds. then execute the save and finally close the workbook. Try something
like this in the ThisWorkbook code module.

Private bProgramClosing As Boolean

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Not bProgramClosing Then
UserForm7.Show False
Application.OnTime Now + TimeValue("00:00:2"),
"ThisWorkbook.CloseWorkBook"
Cancel = True
End If
End Sub

Sub CloseWorkBook()
ThisWorkbook.Save
bProgramClosing = True
Me.Close
End Sub



--
Hope that helps.

Vergel Adriano


"Curt" wrote:

False made the userform lose all graphics nothing but a blank whits screen.
Save worked as should. Maybe the close button on excel could trigger the form
and use the form to save and close. have never used the close x to do
something like this.
Do have the userform option button so will save and close. Am trying to have
this be seen while program closes
Thanks

"Vergel Adriano" wrote:

Curt,

You need to show the form as non-modal.. Give this a try:


Private Sub Workbook_BeforeClose(Cancel As Boolean)

UserForm7.Show False
DoEvents
ThisWorkbook.Save

End Sub


--
Hope that helps.

Vergel Adriano


"Curt" wrote:

Have a befor close save event works fine want to if possible have a userform
show while save is going on then close workbook ie excel Tried this no go
also tried an option button on userform no go.
Would like userform7 to show while save is goung on them shut down. Hope I
made this understandable.
Thanks to all

Private Sub Workbook_BeforeClose(cancel As Boolean)
UserForm7.Show
' ThisWorkbook.Save
'UserForm7.Show
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default trying to get out

my goof I didn't relize doevents was a vbe code put it in and bingo all is fine
Thanks

"Vergel Adriano" wrote:

The call to DoEvents should have painted the user form before initiating the
workbook save...

Another way might be to show the user form as non modal, wait for 1 or 2
seconds. then execute the save and finally close the workbook. Try something
like this in the ThisWorkbook code module.

Private bProgramClosing As Boolean

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Not bProgramClosing Then
UserForm7.Show False
Application.OnTime Now + TimeValue("00:00:2"),
"ThisWorkbook.CloseWorkBook"
Cancel = True
End If
End Sub

Sub CloseWorkBook()
ThisWorkbook.Save
bProgramClosing = True
Me.Close
End Sub



--
Hope that helps.

Vergel Adriano


"Curt" wrote:

False made the userform lose all graphics nothing but a blank whits screen.
Save worked as should. Maybe the close button on excel could trigger the form
and use the form to save and close. have never used the close x to do
something like this.
Do have the userform option button so will save and close. Am trying to have
this be seen while program closes
Thanks

"Vergel Adriano" wrote:

Curt,

You need to show the form as non-modal.. Give this a try:


Private Sub Workbook_BeforeClose(Cancel As Boolean)

UserForm7.Show False
DoEvents
ThisWorkbook.Save

End Sub


--
Hope that helps.

Vergel Adriano


"Curt" wrote:

Have a befor close save event works fine want to if possible have a userform
show while save is going on then close workbook ie excel Tried this no go
also tried an option button on userform no go.
Would like userform7 to show while save is goung on them shut down. Hope I
made this understandable.
Thanks to all

Private Sub Workbook_BeforeClose(cancel As Boolean)
UserForm7.Show
' ThisWorkbook.Save
'UserForm7.Show
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"