CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Speak (VBA) - Method or data member not found

  1. #1
    Join Date
    Jun 2021
    Posts
    1

    Speak (VBA) - Method or data member not found

    Suddenly I cannot get .Speak to work without the above error. The macro below worked fine, until it didn't and started getting this error. Suggestions?

    Code:
    Sub Range()
    '
    ' Range Macro
    '
    '
    Dim rng As Word.Range
    Dim SearchString As String
    'Dim Speak As SpVoice
    Dim Speech As SpeechLib.SpVoice
    Set rng = ActiveDocument.Content
    Set Speech = New SpVoice
    SearchString = """"
    
    With rng.Find
    'rng.Find.ClearFormatting
        Do While .Execute(findText:=SearchString, Forward:=True) = True
          rng.MoveEndUntil (".?,;!")
        
    'Speech.Speak "Hello"
     
          Application.Speech.Speak "speaking", SVSFlagsAsync '+ SVSFPurgeBeforeSpeak
       'Speak "speaking", SVSFlagsAsync '+ SVSFPurgeBeforeSpeak
           MsgBox rng.Text
          Exit Do
          rng.Collapse wdCollapseEnd
        Loop
        
    End With
    
    End Sub
    Last edited by VictorN; June 8th, 2021 at 01:44 AM. Reason: added CODE tags

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,986

    Re: Speak (VBA) - Method or data member not found

    [Moved from Chit Chat forum]
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)