# VBA April Fools Office Prank



## xcelljunkie (Feb 8, 2014)

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!


----------



## mole999 (Feb 9, 2014)

have a read round the lounge, there is at least one thread there that has all these outlandish ideas explored


----------



## PaddyD (Feb 9, 2014)

This one:

http://www.mrexcel.com/forum/lounge...l-practical-jokes-pranks-mean-tricks-etc.html


----------



## dispelthemyth (Feb 18, 2014)

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


----------



## mole999 (Feb 18, 2014)

RAND is in there, not sure about spurious file openings though


----------



## dispelthemyth (Feb 20, 2014)

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


```
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
```






mole999 said:


> RAND is in there, not sure about spurious file openings though


----------



## dispelthemyth (Feb 20, 2014)

Also it will probably only work for Excel 2007 atm as the below code needs to be updated



```
strKeyPath = "Software\Microsoft\Office\12.0\Excel\File MRU\"
```
</pre>


----------



## mfexcel (Feb 20, 2014)

I have a non-vba one... and kinda of manual...
go to the PC of your colleagues, press CTRL ALT ↓ (up arrow key)


----------

