LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

add caption to MS Word image using activex

Solved!
Go to solution

I used LabVIEW to add an image at a bookmark in a Word document. Now I'm trying to add a caption to that image, but having no luck. I keep getting errors on my InsertCaption method--either "Error -2146824090 occurred at Exception occured in Microsoft Word: Command failed" or Type mismatch, depending on the parameters I use.

 

I've browsed this forum and others, but can only find solutions for those that have the report generation toolkit, which I do not.

 

Code is attached. Any ideas?

 

Justin

0 Kudos
Message 1 of 5
(3,688 Views)

Are you making the caption another bookmark? That's what I would do.

0 Kudos
Message 2 of 5
(3,682 Views)

Yeah, I could do it that way. I'd prefer to use the InsertCaption functionality though--seems cleaner. I suppose if I can't find out how to make this node work, that's what I'll end up doing.

0 Kudos
Message 3 of 5
(3,673 Views)
Solution
Accepted by topic author SIS-justin

You need to define your label before using it with the Insert Caption method. You can modify your VI as in the attached picture to add the label you want to use to the CaptionLabels collection. You will then be able to use it.

 

Ben64

 

Wordwriteimage_BD.png

Message 4 of 5
(3,667 Views)

Beautiful! Works great, thank you!

 

I've attached the working code in case anyone else ever needs something similar...

0 Kudos
Message 5 of 5
(3,661 Views)