VBA如何控制msn或Messenger

請問要如何讓下列語法運作

小寫自動變大寫了 應該是沒有寫錯

但偵錯說 使用者自訂型態尚未定義

是不是需要API等呼叫才能使用

還是語法有錯誤呢?

謝謝

Dim aMSN As New Messenger

aMSN.Dialog "dieselsu@hotmail.com", aa

1 Answer

Rating
  • Brian
    Lv 5
    1 decade ago
    Favorite Answer

    [工具]->[設定引用項目], 引用 Messenger API Type Library

    Sub sendMSN()

    Dim oMSN As New Messenger

    Dim oContact As IMessengerContact

    Dim i As Integer

    For i = 0 To oMSN.MyContacts.Count - 1

    If oMSN.MyContacts(i).SigninName = "name@abc.com" Then

    Set oContact = oMSN.MyContacts(i)

    Exit For

    End If

    Next i

    oMSN.InstantMessage oContact

    DoEvents

    SendKeys "test" & "{Enter}"

    End Sub

Still have questions? Get your answers by asking now.