VBA April Fools Office Prank

xcelljunkie

New Member
Joined
Feb 27, 2013
Messages
10
Hi All,

I know this is slightly out of the normal range of questions/posts usually made, but I'm hoping this will be a fun challenge that everyone can participate in. I'm trying to prepare early this year for a great April fools prank for my pals at the office. I'm known as the excel guy at work, so i think it only fitting that I use excel as my means of delivery. What I have come up with so far is a scheme to save an addon or code to their personal macro workbook that will only begin running on April 1st. Otherwise it would be obvious that I am the culprit. I'm thinking any one or a combination of the following.
1.Playing a fart noise/or other sounds whenever they close a workbook or something of that nature.
2.Turning on the "Speak cells" function every so often. (It is likely that they will call me in as it is excel related. I will non-nonchalantly tell them I can fix it, only to have the macro turn it back on a little later.)
3.Anything else that your imaginative brains can come up with.

Rules:
1.Aside from starting some other program to make a noise or something, it must only affect excel.
2.Nothing that will cause will cause anybody to lose any work, which includes the loss of the back button. I planned on getting around this by only using triggers that already disable the back button, ex: closing a workbook, or functions like speak that won't disable the back button.
3.Nothing malicious. Lets keep it fun.

Thanks in advance your creativity and ideas! This should be a blast!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
have a read round the lounge, there is at least one thread there that has all these outlandish ideas explored
 
How about a random event (occurs between 1 and 10% of the time) that randomly opens up one of their recent pages from the internet or a recently closed file
 
RAND is in there, not sure about spurious file openings though
 
Just checked and all the recent files are stored in memory, the below is a file i put together that see some of your recent files and then
randomly opens and makes active the file you open

https://www.dropbox.com/s/frogev7hjgm6zwn/AprilFools.xlsm



Code i have used is below adapted from another macro i access the registry for

Code:
Sub RandomFileOpen()


Const HKEY_CURRENT_USER = &H80000001
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD = 4
Const REG_MULTI_SZ = 7


On Error GoTo ErrorHandler


strComputer = "."
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
 strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Office\12.0\Excel\File MRU\"
objReg.EnumValues HKEY_CURRENT_USER, strKeyPath, arrEntryNames, arrValueTypes


For i = 0 To UBound(arrEntryNames)


ReDim StaticArray(0 To UBound(arrEntryNames)) As Variant


 Select Case arrValueTypes(i)
 Case REG_SZ
 objReg.GetStringValue HKEY_CURRENT_USER, strKeyPath, arrEntryNames(i), strvalue
 
 StaticArray(i) = Mid(strvalue, InStr(1, strvalue, "*") + 1, Len(strvalue) - InStr(1, strvalue, "*"))


 End Select
Next
i = Int((UBound(arrEntryNames) - 1 + 1) * Rnd + 1)
R = StaticArray(i)


Workbooks.Open (R)
FName = Mid(R, InStrRev(R, "\") + 1, 999)


Workbooks(FName).Activate
Exit Sub


ErrorHandler:




End Sub




RAND is in there, not sure about spurious file openings though
 
Last edited:
Also it will probably only work for Excel 2007 atm as the below code needs to be updated


Code:
strKeyPath = "Software\Microsoft\Office\12.0\Excel\File MRU\"
</pre>
 
I have a non-vba one... and kinda of manual...
go to the PC of your colleagues, press CTRL ALT ↓ (up arrow key)
 

Forum statistics

Threads
1,214,543
Messages
6,120,123
Members
448,947
Latest member
test111

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