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 2013 アイコン一覧(P)

    ・Office 2013 アイコン一覧 NUM…

  2. Office アドイン

    [Office用アプリ]仕事の息抜きにピッタリ「もぐらミニ」

    KumaP氏作の作業ウィンドウアプリ「もぐらミニ」がOffice スト…

  3. Office関連

    「変更履歴とコメントの表示」を設定するWordマクロ

    Microsoft コミュニティに「変更履歴とコメントの表示」オプショ…

  4. Office アドイン

    office-toolboxを使って簡単にOffice アドインを作成する方法

    以前「YO OFFICE」を使ってOffice アドインのひな型を作成…

  5. Office アドイン

    [Officeアドイン]アドイン コマンド(Add-In Commands)の紹介

    前回の記事は“Office アドイン”のAdvent calendar…

コメント

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

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

Time limit is exhausted. Please reload CAPTCHA.

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

Translate

最近の記事

アーカイブ

PAGE TOP