From: gimme_this_gimme_that on 18 Jun 2010 15:59 Thanks. I took out the Dim statements - but when I do that the statement p.MyContacts fails. ======= Const MPHONE_TYPE_WORK = 1 Sub showContacts() Dim p As CommunicatorAPI.Messenger Dim s As CommunicatorAPI.IMessengerContacts Dim t As CommunicatorAPI.IMessengerContact Dim o As CommunicatorAPI.IMessengerContact Dim w As String Dim v As Long v = 1 w = "" Set p = CreateObject("Communicator.UIAutomation") p.AutoSignin Set s = p.MyContacts For v = 1 To s.count - 1 Set o = s.Item(v) Next v End Sub showContacts() ===== Here is the VBA counterpart that works in Excel if you've referenced the Comunicator libraries - that puts info into a Spreadsheet. Const MPHONE_TYPE_WORK = 1 Sub showContacts() Dim p As CommunicatorAPI.Messenger Dim s As CommunicatorAPI.IMessengerContacts Dim t As CommunicatorAPI.IMessengerContact Dim o As CommunicatorAPI.IMessengerContact Dim w As String Dim v As Long v = 1 w = "" Set p = CreateObject("Communicator.UIAutomation") p.AutoSignin Set s = p.MyContacts Dim b As Workbook Dim sh As Worksheet Set b = ActiveWorkbook Set sh = b.Sheets(1) sh.Activate sh.Cells(1, 1).Select For v = 1 To s.count - 1 Set o = s.Item(v) sh.Cells(v, 1).Value = o.FriendlyName sh.Cells(v, 2).Value = CStr(o.Status) sh.Cells(v, 3).Value = o.PhoneNumber(MPHONE_TYPE_WORK) Next v End Sub
From: mbyerley on 18 Jun 2010 16:57 Don't remove the DIM statements, just remove the dataType assignment like your statement: Dim p As CommunicatorAPI.Messenger becomes just: Dim p Also, once you have done this, you can still prototype this in the VBA editor in Excel (or any office VBA editor for that matter) <gimme_this_gimme_that(a)yahoo.com> wrote in message news:c3b1632f-3428-4231-a738-3cf73ad792d8(a)32g2000prq.googlegroups.com... > Thanks. > > I took out the Dim statements - but when I do that the statement > p.MyContacts fails. > > ======= > > Const MPHONE_TYPE_WORK = 1 > > Sub showContacts() > Dim p As CommunicatorAPI.Messenger > Dim s As CommunicatorAPI.IMessengerContacts > Dim t As CommunicatorAPI.IMessengerContact > Dim o As CommunicatorAPI.IMessengerContact > > Dim w As String > Dim v As Long > v = 1 > w = "" > Set p = CreateObject("Communicator.UIAutomation") > p.AutoSignin > Set s = p.MyContacts > > For v = 1 To s.count - 1 > Set o = s.Item(v) > Next v > > End Sub > > showContacts() > > ===== > > Here is the VBA counterpart that works in Excel if you've referenced > the Comunicator libraries - that puts info into a Spreadsheet. > > > > > Const MPHONE_TYPE_WORK = 1 > > Sub showContacts() > Dim p As CommunicatorAPI.Messenger > Dim s As CommunicatorAPI.IMessengerContacts > Dim t As CommunicatorAPI.IMessengerContact > Dim o As CommunicatorAPI.IMessengerContact > > > Dim w As String > Dim v As Long > v = 1 > w = "" > Set p = CreateObject("Communicator.UIAutomation") > p.AutoSignin > Set s = p.MyContacts > > Dim b As Workbook > Dim sh As Worksheet > Set b = ActiveWorkbook > Set sh = b.Sheets(1) > sh.Activate > sh.Cells(1, 1).Select > > For v = 1 To s.count - 1 > Set o = s.Item(v) > sh.Cells(v, 1).Value = o.FriendlyName > sh.Cells(v, 2).Value = CStr(o.Status) > sh.Cells(v, 3).Value = o.PhoneNumber(MPHONE_TYPE_WORK) > Next v > > End Sub >
From: gimme_this_gimme_that on 18 Jun 2010 17:06 Good tip. It's still fails on p.MyContacts... Const MPHONE_TYPE_WORK = 1 Sub showContacts() Dim p Dim s Dim t Dim o Dim w Dim v v = 1 w = "" Set p = CreateObject("Communicator.UIAutomation") p.AutoSignin Set s = p.MyContacts For v = 1 To s.count - 1 Set o = s.Item(v) Next End Sub showContacts()
From: mbyerley on 18 Jun 2010 19:23 <gimme_this_gimme_that(a)yahoo.com> wrote in message news:d113cdd9-2788-485e-b9ec-e3446163143f(a)q39g2000prh.googlegroups.com... > Good tip. > > It's still fails on p.MyContacts... > Well, I'm not going to download the SDK just to get to the answer. To find your trouble, in the Office VBA Editor of your choice, revert back to your original code, using AS to assign the correct datatypes and use early binding instead of CreateObject. BTY, in your test module or form, whichever you use, you will have to go to Tools>References and set a Reference to the Library containing the Communicator.UIAutomation object. Then you will have intellisense to help you. Also, you can then use the Object Browser on the toolbar to look at the properties and methods of the object to help you sort it out. Once you have it working using early binding, you can then convert it to the respective VBScript using late binding. > Const MPHONE_TYPE_WORK = 1 > > Sub showContacts() > Dim p > Dim s > Dim t > Dim o > > Dim w > Dim v > v = 1 > w = "" > Set p = CreateObject("Communicator.UIAutomation") > p.AutoSignin > Set s = p.MyContacts > > For v = 1 To s.count - 1 > Set o = s.Item(v) > Next > > End Sub > > showContacts() >
From: mbyerley on 18 Jun 2010 19:45 I downloaded the SDK anyway. It looks like this was intended for a .NET useage even though there is a reference to object instantiation using JScript. For Script usage, it doesn't say to register the DLLs or how to reference them. If I have time tomorrow, I'll look again, but if your original code worked up to the point of p.MyContacts, you should trace your code up to that point, then look at your p variable in the watch list and walk its properties to see if you are exposing it or not. <gimme_this_gimme_that(a)yahoo.com> wrote in message news:d113cdd9-2788-485e-b9ec-e3446163143f(a)q39g2000prh.googlegroups.com... > Good tip. > > It's still fails on p.MyContacts... > > > Const MPHONE_TYPE_WORK = 1 > > Sub showContacts() > Dim p > Dim s > Dim t > Dim o > > Dim w > Dim v > v = 1 > w = "" > Set p = CreateObject("Communicator.UIAutomation") > p.AutoSignin > Set s = p.MyContacts > > For v = 1 To s.count - 1 > Set o = s.Item(v) > Next > > End Sub > > showContacts() >
|
Next
|
Last
Pages: 1 2 Prev: Reading XML objNode Value Next: PnPCapabilities, powermanagement and Windows 7 |