VBA and GetHierarchy

C

CGram

Can anyone help with getting the Onenote hierarchy via VBA ? I'm a little
beyond my experience range with this. I've added the reference to OneNote12,
but the 3rd line won't compile:

Dim onApp As New OneNote12.Application
Dim outStr As String
onApp.GetHierarchy("",OneNote12.HierarchyScope.hsPages,outStr)

Thanks
 
I

Ilya Koulchin

CGram said:
Can anyone help with getting the Onenote hierarchy via VBA ? I'm a little
beyond my experience range with this. I've added the reference to OneNote12,
but the 3rd line won't compile:

Please include the compiler error, as well as all the relevant parts of
the source file.
 
C

CGram

The error reads: "Compile error: Syntax Error" - occurs on the 4th line
below...

*********************
Sub gethrchy()

Dim onApp As New OneNote12.Application
Dim outstr As String

onApp.GetHierarchy("", onenote12.HierarchyScope.hsPages, outstr)

Stop

End Sub
**********

Thanks
 
I

Ilya Koulchin

I can't spot anything wrong from just looking at it, although I'm not
particularly familiar with VBA. You might want to ask on VBA forums.
Also, you might want to invest in a compiler that spits out more useful
error messages - most modern compilers should be providing you with the
offending token whenever they report a syntax error.
 
D

David Olsen

Try this:

Sub gethrchy()

Dim onApp As New OneNote12.Application

Dim outstr As String

onApp.GetHierarchy "", hsPages, outstr

Stop

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top