Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug? with MS Outlook typelib QM compiler syntax checking
#1
I'm trying to write a QM macro to open a sub-folder under the Outlook Inbox folder.
I'm getting a QM compiler syntax error for this code on the last line:
typelib Outlook {00062FFF-0000-0000-C000-000000000046} 9.3
Outlook.Application app._getactive
Outlook.NameSpace ns=app.GetNamespace("MAPI")
Outlook.MAPIFolder f
Outlook.MAPIFolder fInbox=ns.GetDefaultFolder(Outlook.olFolderInbox)
f=fInbox.Folders("test")
> Error in openOutlookFolder: Expected 0 arguments, not 1.

This code works in VBscript:
Dim OutlookApp 'As Outlook.Application
Dim ns 'As NameSpace
Dim folder 'As MAPIFolder
dim olFolderInbox
olFolderInbox=6
Set OutlookApp = GetObject(, "Outlook.Application")
Set ns = OutlookApp.GetNamespace("MAPI")
Set folder = ns.GetDefaultFolder(olFolderInbox)
Set folder = folder.Folders("test")
Set OutlookApp.ActiveExplorer.CurrentFolder = folder

The VBscript code has no type checking.

QM prompts (at the bottom left of the editor screen) that the fInbox.Folders() accepts no parameters, but passing a parameter to .Folders() works at runtime in the VBscript code.

Maybe the Outlook typelib information is not accurate.
How can I disable compile-time syntax checking and catch any error at runtime?
Thanks for any help you can offer,
John
#2
Not bug, but QM and VB work slightly differently. QM is more raw.

f=fInbox.Folders.Item("test")

In VB you can skip Item function of collections to make code shorter.

----

To disable type checking and catch any error at run time, declare variables as IDispatch.

IDispatch f
IDispatch fInbox=ns.GetDefaultFolder(Outlook.olFolderInbox)
f=fInbox.Folders("test")
out f
#3
Thanks, Gintaras.
Quick Macros is great - easy to use and very powerful - and your support is astounding.
I'm very grateful for your wonderful program.
Regards,
John

PS: I didn't receive an email when you posted a reply to my problem. Are email notifications working ok?
#4
Forum email temporarily does not work.


Forum Jump:


Users browsing this thread: 1 Guest(s)