Posts by lifelessalarm

    I am a beginner when it comes to vba, so bear with me. I want to increase the text to speech speed for a selection. I don't mean the speed of the speech itself but rather the speed at which excel moves to the next cell. I have currently tried using "Purge:True" and "SpeakAsync:True" but the results seem to only half work, it seems to increase the speed for the first few cells only and then slow down thereafter. The code I am using is below, it is adapted from a solution to decrease the speed but I wish to achieve the opposite. Ideally, I would like to be able to adjust the speed at which excel moves to the next cell. Any help would be appreciated.



    Sub SpeakCells()
    Dim rRange As Range
    Dim rCell As Range


    Set rRange = Selection


    For Each rCell In rRange
    Application.Speech.Speak rCell.Text, Purge:=True, SpeakAsync:=True
    Application.Wait (Now + TimeValue("00:00:01"))
    Next rCell


    End Sub



    ----------------------------------------------------------------------------------------------------------------


    *EDIT*
    This has now been solved with the following code:


    Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Sub SpeakCells()
    Dim rRange As Range
    Dim rCell As Range


    Set rRange = Selection


    For Each rCell In rRange
    Application.Speech.Speak rCell.Text, Purge:=True, SpeakAsync:=True
    Sleep 1000 'wait 1000 milliseconds (1 second)
    Next rCell


    End Sub