A personal repository of random information in compensation for a fatigued biological computer
Breaded IT » Excel specific reminders
Get window handle:
application.hwnd
Voice
Sub testvoice()
Dim objVOICE As Object
Dim objToken As Object
Dim strText As String
strText = "Helen, HELEN, Wake! up! Smell the roses girlfriend."
Set objVOICE = CreateObject("SAPI.SpVoice")
objVOICE.Speak strText
Debug.Print objVOICE.isUISupported("SpeechAudioVolume")
'objVOICE.displayui(Application.Hwnd, "title", "SpeechAudioVolume")
Set objVOICE = CreateObject("SAPI.SpVoice")
For Each objToken In objVOICE.GetVoices
Debug.Print objToken.GetDescription
Next objToken
End Sub
Beep
Option Explicit
'API Declaration
Private Declare Function MessageBeep& Lib "user32" (ByVal wType As Long)
'Enumeration of the beep types
Public Enum BeepTypes
MB_OK = &H0&
MB_ICONASTERISK = &H40&
MB_ICONEXCLAMATION = &H30&
MB_ICONHAND = &H10&
End Enum
Public Function BeepType(lSound As BeepTypes) As Long
' Function to return
BeepType = MessageBeep(lSound)
End Function
Sub TestTheBeep()
' Play the beep
BeepType MB_ICONHAND
End Sub
String to integer checking:
On Error GoTo SeriesMisMatchWErr13
MisMatch13 = False
intResult = CInt(rCell.Value)
If Not MisMatch13 Then
SeriesMisMatchWErr13:
If Err = 13 Then 'Type Mismatch
MisMatch13 = True
Resume Next
End If
SeriesFinish:
On Error GoTo 0
ActiveSheet.Shapes("AutoShape 1").Select
Paste macros
Sub PasteAsText() ' ' PasteAsText Macro ' Edit -> Paste Special -> As Text ' Keyboard Shortcut: Ctrl+Shift+V ' ActiveSheet.PasteSpecial Format:="Text", Link:=False, DisplayAsIcon:= _ False End Sub Sub F2ThenPaste() ' ' F2ThenPaste Macro ' F2 then paste into cell ' ' Keyboard Shortcut: Ctrl+Shift+P ' Application.SendKeys "{F2}" Application.SendKeys "^v" Application.SendKeys "~" Application.SendKeys "{UP}" End Sub
xxx