ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pop-up box with no 'okay' buttons (https://www.excelbanter.com/excel-programming/304794-pop-up-box-no-okay-buttons.html)

ForSale[_13_]

Pop-up box with no 'okay' buttons
 
Private Sub Workbook_BeforeClose(CANCEL As Boolean)

Dim cTime As Long
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")
cTime = 1 ' 1 secs
Select Case WSH.Popup("Last Updated By" & Application.UserName, cTime
"Closing", vbOKOnly)
End Select

Call macro1

End Sub

this pops up a box that says last updated by & username, then goes awa
after 1 second. the only thing that i would change about it, is tha
it has an 'okay' button on it. is it possible to have no buttons

--
Message posted from http://www.ExcelForum.com


K Dales

Pop-up box with no 'okay' buttons
 
You could do this more simply with a UserForm - design one
with a TextBox (here called TextBox1) and set the
ShowModal Property to False; then you can use this code:

Private Sub Workbook_BeforeClose(CANCEL As Boolean)

Dim StartTime As Date

UserForm1.TextBox1.Value = "Last Updated By " &
Application.UserName

StartTime = Now

UserForm1.Show

While StartTime (Now - TimeValue("00:00:10"))
DoEvents
Wend

UserForm1.Hide

End Sub

-----Original Message-----
Private Sub Workbook_BeforeClose(CANCEL As Boolean)

Dim cTime As Long
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")
cTime = 1 ' 1 secs
Select Case WSH.Popup("Last Updated By" &

Application.UserName, cTime,
"Closing", vbOKOnly)
End Select

Call macro1

End Sub

this pops up a box that says last updated by & username,

then goes away
after 1 second. the only thing that i would change about

it, is that
it has an 'okay' button on it. is it possible to have no

buttons?


---
Message posted from http://www.ExcelForum.com/

.


ForSale[_20_]

Pop-up box with no 'okay' buttons
 
Thanks,
that works good, however, it doesn't seem to go away on it's own.
changed the 00:00:10 to 00:00:01 and it didn't ever get to th
userform.hide
any suggestions

--
Message posted from http://www.ExcelForum.com


K Dales

Pop-up box with no 'okay' buttons
 
Don't know why it isn't getting to UserForm.Hide. Are you
sure you have the While loop set up properly, with a
DoEvents inside it? And that the UserForm's Modal
property is False? Those would be the most likely things
to cause problems. The code I sent worked on my machine
as written - was a cut and paste; I am using Excel 2000.

-----Original Message-----
Thanks,
that works good, however, it doesn't seem to go away on

it's own. i
changed the 00:00:10 to 00:00:01 and it didn't ever get

to the
userform.hide
any suggestions?


---
Message posted from http://www.ExcelForum.com/

.


ForSale[_30_]

Pop-up box with no 'okay' buttons
 
i'm on XP professional. here is the code in question:

Public Sub UserFormClose()

Dim StartTime As Date

UserForm3.Label1.Caption = "Last Updated By " & Application.UserName

StartTime = Now

UserForm3.Show

While StartTime (Now - TimeValue("00:00:01"))
DoEvents
Wend

UserForm3.Hide

End Sub

still not getting to the hide line.

thanks.


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 08:42 AM.

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