Jon von der Heyden
MrExcel MVP, Moderator
- Joined
- Apr 6, 2004
- Messages
- 10,910
- Office Version
- 365
- Platform
- Windows
I think I could go one further. One could actually create a list of things to speak, in order. Each time a shortcut is pressed, it speaks the next item in the list. That way you could you play mind games. The following exhibit plays each line of "Can't touch this" each time a shortcut is pressed...
In a standard module:
If you manage to get onto a colleagues machine, create your own list and paste it to a sheet in his/her personal workbook. Add the code to a standard module and then run 'NewKeys'.
Remember to reset the keys (run 'ResetKeys') before it goes too far and you get fired.
*Course this doesn't work if speakers are turned off. You can fiddle that with API, but I think that's just going too far.
Excel 2010 | ||||
---|---|---|---|---|
A | B | |||
1 | My, my, my music hits me so hard | X | ||
2 | Makes me say "Oh my Lord" | |||
3 | Thank you for blessing me | |||
4 | With a mind to rhyme and two hype feet | |||
5 | It feels good, when you know you're down | |||
6 | A super dope homeboy from the Oaktown | |||
7 | And I'm known as such | |||
8 | And this is a beat, uh, you can't touch | |||
9 | I told you homeboy, (You can't touch this) | |||
10 | Yeah, that's how we living and you know, (You can't touch this) | |||
11 | Look at my eyes, man, (You can't touch this) | |||
12 | Yo, let me bust the funky lyrics, (You can't touch this) | |||
Sheet1 |
In a standard module:
Code:
Public Sub SpeakNextItem()
Dim lngCurrentRow As Long
Dim lngLastRow As Long
Dim lngNextRow As Long
With Sheet1
lngCurrentRow = Application.Match("X", .Columns(2), 0)
lngLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
With .Cells(lngCurrentRow, "A")
Application.Speech.Speak .Text
.Offset(, 1).Clear
End With
If lngCurrentRow = lngLastRow Then
lngNextRow = 1
Else
lngNextRow = lngCurrentRow + 1
End If
.Cells(lngNextRow, "B").Value = "X"
End With
End Sub
Public Sub NewKeys()
With Application
.OnKey "^a", "SpeakNextItem" 'select all
.OnKey "^b", "SpeakNextItem" 'bold
.OnKey "^c", "SpeakNextItem" 'copy
.OnKey "^f", "SpeakNextItem" 'find
.OnKey "^h", "SpeakNextItem" 'find & replace
.OnKey "^i", "SpeakNextItem" 'italic
.OnKey "^o", "SpeakNextItem" 'open
.OnKey "^s", "SpeakNextItem" 'save
.OnKey "^u", "SpeakNextItem" 'u
.OnKey "^v", "SpeakNextItem" 'paste
.OnKey "^w", "SpeakNextItem" 'close
.OnKey "^x", "SpeakNextItem" 'cut
.OnKey "^y", "SpeakNextItem" 'redo
.OnKey "^z", "SpeakNextItem" 'undo
End With
End Sub
Public Sub ResetKeys()
With Application
.OnKey "^a" 'select all
.OnKey "^b" 'bold
.OnKey "^c" 'copy
.OnKey "^f" 'find
.OnKey "^h" 'find & replace
.OnKey "^i" 'italic
.OnKey "^o" 'open
.OnKey "^s" 'save
.OnKey "^u" 'u
.OnKey "^v" 'paste
.OnKey "^w" 'close
.OnKey "^x" 'cut
.OnKey "^y" 'redo
.OnKey "^z" 'undo
End With
End Sub
If you manage to get onto a colleagues machine, create your own list and paste it to a sheet in his/her personal workbook. Add the code to a standard module and then run 'NewKeys'.
Remember to reset the keys (run 'ResetKeys') before it goes too far and you get fired.
*Course this doesn't work if speakers are turned off. You can fiddle that with API, but I think that's just going too far.
Last edited: