Discussion:
VBA and GetHierarchy
(too old to reply)
CGram
2009-05-18 18:04:32 UTC
Permalink
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
Ilya Koulchin
2009-05-18 18:43:54 UTC
Permalink
Post by 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,
Please include the compiler error, as well as all the relevant parts of
the source file.
CGram
2009-05-19 01:14:02 UTC
Permalink
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
Post by Ilya Koulchin
Post by 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,
Please include the compiler error, as well as all the relevant parts of
the source file.
Ilya Koulchin
2009-05-20 00:01:18 UTC
Permalink
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.
Post by 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
Post by Ilya Koulchin
Post by 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,
Please include the compiler error, as well as all the relevant parts of
the source file.
David Olsen
2009-05-20 03:24:47 UTC
Permalink
Try this:

Sub gethrchy()

Dim onApp As New OneNote12.Application

Dim outstr As String

onApp.GetHierarchy "", hsPages, outstr

Stop

End Sub
--
David Olsen
www.powerbits.com.au
Post by 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.
Post by 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
Post by Ilya Koulchin
Post by 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
Please include the compiler error, as well as all the relevant parts of
the source file.
Loading...