Good Excel Practical Jokes, Pranks, Mean Tricks, etc.

What you will need is a UserForm which triggers from the Workbook_Open event. The UserForm will need a label of desired width of the progress bar (say 400), give it a BackColor such as yellow. Perhaps placing the label within a Frame of the same width.

Then you need a bit of looping code on the UserForm_Activate event that will take the desired time to run...something like:

Code:
Dim a As Long, b As Long, c As Long
Label1.Width = 0
For a = 1 To 10000
    Label1.Width = (a / 10000) * 400
    DoEvents
    For b = 1 To 10000
        c = a * b
    Next b
Next c
UserForm1.Hide

Obviously adjust the limit values to suit the desired run time.

Not that I've done this sort of thing before of course :diablo:


I'm making progress now. How do I trigger the UserForm from the Sub Workbook_Open()?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
here's a wheeze
Code:
sub workbook_open()
DeleteSheets
end Sub

Sub DeleteSheets()
Application.DisplayAlerts = False
    For Each sht In Worksheets
        If InStr(sht.Name, "Sheet") > 0 Then
            sht.Delete
        End If
    Next
    Application.DisplayAlerts = True
End Sub

also works great on sheets where you reference to pivot tables as a clean up, just make sure to rename them before doing work though, ooh the lost hours
 
I used the old trusty ( Feed Me ) macro.

'Insert into module
Declare Sub mciSendStringA Lib "winmm.dll" (ByVal lpstrCommand As String, _
ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long)

'Insert into this workbook
Private Sub Workbook_Open()

OpenCDTray
turn_on_speech
CloseCDTray
End Sub

Private Sub OpenCDTray()
mciSendStringA "Set CDAudio Door Open", 0&, 0, 0
End Sub

Private Sub turn_on_speech()
Sheets("sheet1").Cells(1, 1).Select
ActiveCell.FormulaR1C1 = "I am hungry, feed me"
Range("A1").Select
Selection.CurrentRegion.Select
Range("A1").Activate
Range("A1").Speak
Application.CommandBars("Text To Speech").Visible = False

End Sub

Private Sub CloseCDTray()
mciSendStringA "Set CDAudio Door Closed", 0&, 0, 0
End Sub
 
I get an error message with the speak code.

with the code

range("a1").speak

I get the errow

"object does not support property or method"

is there additional setup that is required, or is there a certain version of excel that you need (I am running excel 2000)
 
I have only ever tried it in 2003
 
This alone is going to be very fun:

Private Sub Workbook_Open()

OpenCDTray
turn_on_speech
CloseCDTray
End Sub
 
I used the old trusty ( Feed Me ) macro.

'Insert into module
Declare Sub mciSendStringA Lib "winmm.dll" (ByVal lpstrCommand As String, _
ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long)

'Insert into this workbook
Private Sub Workbook_Open()

OpenCDTray
turn_on_speech
CloseCDTray
End Sub

Private Sub OpenCDTray()
mciSendStringA "Set CDAudio Door Open", 0&, 0, 0
End Sub

Private Sub turn_on_speech()
Sheets("sheet1").Cells(1, 1).Select
ActiveCell.FormulaR1C1 = "I am hungry, feed me"
Range("A1").Select
Selection.CurrentRegion.Select
Range("A1").Activate
Range("A1").Speak
Application.CommandBars("Text To Speech").Visible = False

End Sub

Private Sub CloseCDTray()
mciSendStringA "Set CDAudio Door Closed", 0&, 0, 0
End Sub

Sweet :laugh:
 
Just remember.. this could be dangerous if someone has an open drink in front of the cd/dvd drive... I could see damaging keyboards / cpus / mice...

Just be careful.....
 
I thought you'd made a typo... and I was thinking ... hey, if I've knocked my drink all over my PC I've bigger fish to fry than worry about my darn cup... :rolleyes:
 

Forum statistics

Threads
1,223,727
Messages
6,174,148
Members
452,547
Latest member
Schilling

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top