Excel

VBAでTTSエンジンの各種情報を列挙する

今回はTTSエンジンの各種情報を列挙するマクロを紹介します。
Microsoft Speech Platformがインストールされていない場合はSAPIからオブジェクトを取得します。

Option Explicit

Public Sub Sample()
  Dim sv As Object
  Dim st As Object
  
  Set sv = CreateSpVoice
  If sv Is Nothing Then Exit Sub
  On Error Resume Next
  For Each st In sv.GetVoices
    Debug.Print "--------------------"
    Debug.Print "ID:" & st.id
    Debug.Print "Name:" & st.GetAttribute("Name")
    Debug.Print "Language:" & st.GetAttribute("Language")
    Debug.Print "Gender:" & st.GetAttribute("Gender")
    Debug.Print "Age:" & st.GetAttribute("Age")
    Debug.Print "Vendor:" & st.GetAttribute("Vendor")
    Debug.Print "--------------------"
  Next
  On Error GoTo 0
  Set sv = Nothing
End Sub

Private Function CreateSpVoice() As Object
  Dim sv As Object

  Set sv = Nothing '初期化
  On Error Resume Next
  Set sv = CreateObject("Speech.SpVoice")
  If Err.Number <> 0 Then
    Set sv = CreateObject("SAPI.SpVoice")
    Err.Clear
  End If
  On Error GoTo 0
  Set CreateSpVoice = sv
End Function

Microsoft Speech Platform Version 11が公開されました。前のページ

2011/09/04次のページ

関連記事

  1. Office関連

    SendKeysでWindowsキーを送信するVBAマクロ

    「VBA SendKeys Windowsキー」といったキーワード検索…

  2. アイコン一覧

    Office 365アイコン(imageMso)一覧(K,L)

    Office 365のデスクトップ版Officeアプリケーション(Wo…

  3. Office関連

    文書が互換モードかどうかを判定するWordマクロ

    古いバージョンのWordで作成された文書を開くと、タイトル バーに「互…

  4. Excel

    Google TTSで文字列を読み上げるマクロ

    2012/02/09 追記:関連記事・Google翻訳…

  5. Office関連

    Internet Explorer用OneNoteアドオンを利用して指定したWebページをOneNo…

    「Evernote Webクリッパーで指定したWebページをEvern…

コメント

  1. この記事へのコメントはありません。

  1. この記事へのトラックバックはありません。

Time limit is exhausted. Please reload CAPTCHA.

※本ページはプロモーションが含まれています。

Translate

最近の記事

アーカイブ

PAGE TOP