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. Excel

    Microsoft Edgeのバージョンに合わせてWebDriverをダウンロードするVBAマクロ

    ブラウザーの制御に広く使われているWebDriverですが、ブラウザー…

  2. Office関連

    「クラシックスタイルメニュー for Office 2010」のOffice 2013対応状況

    私が下記ページで公開しているフリーソフト「クラシックスタイルメニュー …

  3. Office関連

    「ExcelVBAを実務で使い倒す技術」レビュー

    @ateitexeさんの下記ツイートで、高橋宣成氏が執筆された「Exc…

コメント

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

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

Time limit is exhausted. Please reload CAPTCHA.

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

Translate

最近の記事

アーカイブ

PAGE TOP