[python-win32] How to access Visual Basic's "Application" object,
in Python
Tony Cappellini
tony at tcapp.com
Tue Jan 25 21:55:16 CET 2005
I am trying to mimic a short VB program in Python, which iterates over an
Outlook 2002 global address list.
The program runs in VB, so it is working. Unfortunately, I have to have
outlook running for it to work. I was hoping it could be done without
having to launch Outlook. This is only a minor issue though.
However, I don't know what to use in Python, for VB's Application object,
which is like a pointer to the entire process that is running the
application. From Application, I can access the name of the executable,
the version number, tha path, and some other attibutes.
This is the vb
program.
Dim objOL As Outlook.Application
Dim objNS, objAL, objAE, objMember
On Error Resume Next
Set objOL = GetObject(, "Outlook.Application")
If objOL Is Nothing Then
Set objOL = CreateObject("Outlook.Application")
objOL.Session.Logon "my profile", , False, True
End If
Set objNS = Application.GetNamespace("MAPI")
Set objAL = objNS.AddressLists("Global Address List")
Set objAE = objAL.AddressEntries("python users")
Debug.Print objAL.AddressEntries.Count
Debug.Print objAE.Members.Count
For Each objMember In objAE.Members
Debug.Print objMember.Name, objMember.Address
Next
Does nayone have a suggestion?
More information about the Python-win32
mailing list