The following code works when executed in Excel VBA:
Code: Select all
Public Sub test()
Dim onApp As OneNote.Application
Set onApp = CreateObject("OneNote.Application")
Debug.Print onApp.Windows.CurrentWindow.CurrentPageId
End Sub
{19D95969-D617-4F12-8361-64E5A678C0B8}{1}{E1951646190563752473342929088298487209719561}
If I try what appears to be an equivalent in AutoHotkey however, there are problems.
The following code uses EnumComMembers from Lexicos to see if anything is there (spolier: there are no object members listed)
Code: Select all
obj := ComObjCreate(ProgID:="OneNote.Application")
Members := EnumComMembers(obj)
MsgBox % _
. "ProgID=" quote(ProgID) "`n" _
. "Interface: " quote(ComObjType(obj)) "`n" _
. "Interface name: " quote(ComObjType(obj, "name")) "`n" _
. "Interface IID: " quote(ComObjType(obj, "IID"))
ProgID="OneNote.Application"
Interface: "9"
Interface name: ""
Interface IID: ""
Use "OneNote.Application.12" returns the following details, but still no object members:
ProgID="OneNote.Application.12"
Interface: "9"
Interface name: "IApplication"
Interface IID: "{2DA16203-3F58-404F-839D-E4CDE7DD0DED}"
I also looked in the registry to see which OneNote.Application.X items were registered--there were 3 of them (12, 13 and 15?) and I believe the standard "OneNote.Application" was mapped to 15. At any rate the results above were indicative for all of them.
Any ideas on how to get a valid COM Object returned with access for OneNote.Application?
Any other debugging ideas I could try in VBA or AHK?