LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Open Word or PDF file at Specific Heading or Page Number

Solved!
Go to solution

I'm having trouble finding an example of code to "Open Word or PDF file at Specific Heading or Page Number".  I don't want the user to have to provide instruction for what section they should read.  I don't want them to have to  find that section either.   

 

Ideally this needs to be done on a read only document.

 

Any advice is appreciated!

----------------------------------------------------
Studying for CLA.
LabVIEW, inherit from social media habits!
0 Kudos
Message 1 of 12
(4,548 Views)

Here's what I have so far, I used this as a guide https://msdn.microsoft.com/en-us/vba/word-vba/articles/selection-goto-method-word

 

 

----------------------------------------------------
Studying for CLA.
LabVIEW, inherit from social media habits!
0 Kudos
Message 2 of 12
(4,530 Views)

You were close, you need to apply the Go To method to the active window selection object and then apply the selection find property. Note that this doesn't work with a read only document (with a read only doc when you press F5 the Go To dialog will not appear either [Word 2013]).

 

Go To method.png

Ben64

Message 3 of 12
(4,514 Views)

Although that code didn't work for me (at least not for read only);  it did give me an idea when I was about to give up and go home!!  The Range>Selection!  

 

I attached code for opening word at either a page # or at a header. 

(The header option will search all headers and will match the first one that contains the input string (you may have to play with this))

 

Was stuck on this for 5 hours, and was about to abandon this method..

Thanks!

 

----------------------------------------------------
Studying for CLA.
LabVIEW, inherit from social media habits!
0 Kudos
Message 4 of 12
(4,504 Views)

The Open Word at Page or Heading.vi is not included in your zip file.

 

Ben64

0 Kudos
Message 5 of 12
(4,483 Views)
Solution
Accepted by topic author CDuck

Well that won't work.. lol

 

Here, I decided to remove the type def controls so only the VI needs to be shared.

----------------------------------------------------
Studying for CLA.
LabVIEW, inherit from social media habits!
Message 6 of 12
(4,470 Views)

Thanks for sharing, shouldn't the wdGoToHeading constant be in the "Go To Header" case and a wdGoToPage constant in the  "Go To Page" case?

 

Ben64

0 Kudos
Message 7 of 12
(4,463 Views)

Jeez your quick!

Yeah, I actually noticed that right after I posted haha.

I managed to edit the linked VI in the post above.

 

----------------------------------------------------
Studying for CLA.
LabVIEW, inherit from social media habits!
0 Kudos
Message 8 of 12
(4,461 Views)

Hi, would you mind sharing this for 2015 version? Did you guys tried it with pdfs?

 

Cheers,

 

Oz

0 Kudos
Message 9 of 12
(3,885 Views)

I think you can copy the code from the picture provided by ben64. 

0 Kudos
Message 10 of 12
(3,864 Views)