Office関連

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関連

    「個人用テンプレートの既定の場所」を設定するWordマクロ

    前回の記事で、Word 2013で個人用テンプレート(カスタム テンプ…

  2. アイコン一覧

    Office 365アイコン(imageMso)一覧(W)

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

  3. Office関連

    未読アイテムの件数を取得するOutlookマクロ

    「Outlook 未読 件数 マクロ」といったキーワード検索でのアクセ…

  4. Office関連

    Excelのアイデア機能でグラフやピボットグラフを一発作成

    Insider版のExcelに「アイデア」機能が追加されました。…

コメント

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

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

Time limit is exhausted. Please reload CAPTCHA.

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

Translate

最近の記事

アーカイブ

PAGE TOP