LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add jpg to Powerpoint slides

Solved!
Go to solution

I need to automate adding jpg files to Powerpoint slides using LabVIEW. (Don't get me started on using Powerpoint to begin with!) I can open Powerpoint and create a new presentation but can't figure out how to write anything to the slides. All properties and invoke nodes that look promising are read only. The attached screen shot opens a new pptx file. I believe the "ActivePresentation" property would be the next step but I get lost from there.

 

Has anyone worked on anything like this? Even if you added text to a slide, that may help a lot to figure this out.

Thanks,

Bob

0 Kudos
Message 1 of 10
(5,028 Views)

I don't do ActiveX and I don't do PowerPoint, but if I did I would do this.

 

AddImageToPPT.png

Message 2 of 10
(5,022 Views)

Thanks for the suggestion but, unfortunately, my Slides invoke node methods do not match yours. I do not have a method that is simply "Add". Mine is "AddSlide".  It has a required input "pCustomLayout" that has no documentation. I wired a default Automatic Refnum to it (out of desperation) to no avail. Here is the error with the auto refnum wired to the input (the error number is unspecified):

 

Error -2147467259 occurred at Exception occurred in Microsoft Office PowerPoint 2007: Slides (unknown member) : Failed.Help Path is  and context 0 in jpg-pptx 3.vi

 

I am using LV 2009 (soon to upgrade to 2011). Maybe that is the difference. Any suggestions?

0 Kudos
Message 3 of 10
(4,979 Views)

1)  That post pretty much drains my pool of ActiveX information.  I do not use it, but I just figured that I do enough .NET to know how Microsoft thinks. Can't really pinpoint differences due to OS or whatnot.

2)  I use LV9 and Office 2007 so it does not sound like that is an issue.  Did you use the snippet I sent directly, or try to recreate it?

0 Kudos
Message 4 of 10
(4,973 Views)

The snippet was apparently flattened coming into my office. All I had was a screen shot. I recreated your flow exactly and the Slides:Add method was AddSlide. We appear to be using the same LV and PP. (I don't have SP1 installed, maybe that's it) Very strange...

 

Hopefully someone else will post. Thanks for your suggestions.

 

 

0 Kudos
Message 5 of 10
(4,967 Views)
Solution
Accepted by topic author Bob_Albern

Very odd that just the 'Add' method would be missing, probably a PPT issue.  Plan B is to create a template file with a single blank slide and just open it:

 

PPT Image Version 2.png

Message 6 of 10
(4,956 Views)

Well, that worked! One cookie for you (I mean Kudo).

Thanks

0 Kudos
Message 7 of 10
(4,952 Views)

Kudos to Darin, old post is still very helpful.  Was handed a whole lot of VBA code and some excel work from 1996 and re-programmed 90% in labview last night.  This was the icing on the cake that I was unsure how to do and could not have been any easier.  Great shell to expand from.

 

Thanks.

 

Adam

0 Kudos
Message 8 of 10
(4,505 Views)

Kudos indeed to Darin, who initially helped me with exporting XY graphs into PowerPoint.


I followed this link to slighly modify the code to basically use a PowerPoint template (which only has one title page) and add 3 plots to it - one on each page after the title page.

 

I get an error that says a certain number (say 2) is out of range. Also, just like Bob who posted at the very top, I don't have the Add Method that shows Add, Index, and Layout. 
I have one that shows AddSlide, then Index, then a Reference input that reads ppCustomLayout. At any rate, I want the following code to take my title page (read from an existing file)

and add the three images to the PowerPoint (I am using LabVIEW 2011 on Win 7 Pro). I don't want the plots to be pasted onto the first page (title page). The plots should start

on second page, and so on. Actually, the code shown below works just fine if I configure the template to have a title page, and 3 blank pages, but is there a way to have LabVIEW

create those pages?

 

Untitled.jpg

 

 

0 Kudos
Message 9 of 10
(4,291 Views)

If you download the snippet and put it on your BD you can make sure you have access to the same properties that Darin placed above.  I have access to them but not sure why you would not, try the snippet it should get on there.

 

I will try and see if I can reproduce your error.


Adam

0 Kudos
Message 10 of 10
(4,280 Views)