01-27-2017 02:10 PM
So I am a novice to labview Activex for powerpoint. My goal is to use a powerpoint template that is already prefilled. I want to get the strings from a file and open the powerpoint template to fill in the rest. I followed the example in the link below but somehow when I get to the part where I want to select a method that would allow me to add the string I can't find any. the closest I found is ADDTEXTEFFECT but that doesnt work for me.. Any suggestion on how to add text to the existing textbox in the template with my own font type and size and position.
https://forums.ni.com/t5/LabVIEW/Add-jpg-to-Powerpoint-slides/td-p/1676338
Solved! Go to Solution.
01-28-2017 11:06 AM
01-28-2017 12:13 PM
OK, I took a look at the link and used the existing code as a starting point. You won't find any Add TextBox method because there is no such thing as aTextBox object in PP ActiveX. A TextBox is a Shape Object. To acces it use the Item method of the selected slide Shapes Object. For the Item index you can either use a numeric value (based on the order the shapes were added to the slide) or the Shape Object name (which I recommend).
When you create the template you can edit the Shape Object name in the Selection Pane (Home Tab, Editing Section, click the small arrow at the right of "select" and click Selection Pane ...).
Here is a code example:
Ben64
01-29-2017 10:35 AM
Thanks for the reply. Well, my textbox is in my template already. I don't need to add another one. I would like add text string in it. My code is exactly the same as the one in the link up until where the author use the addpicture method. That's where I stopped because I would like to add strings instead. For example. If slide one in my template had a text box prefilled with "The name of the software is: ". I would to take a string from my file called "Labview". And add it to the textbox in my template and make it " The name of the software is: Labview".
01-29-2017 12:05 PM
It seems you didn't try my code because it does exactly what you want: add text to an existing TextBox.
Now if your TextBox contains prefilled text you can:
1- use the TextRange InsertAfter method to append text to the prefilled text or
2- read the TextBox text using the TextRange Text property, concatenate the result with the existing text and write it back again using the TextRange Text property.
Now if you try to use method 1 on an empty TextBox it will generate an error. So even if method 2 is a very little more work it will work without error even if the TextBox is initially empty.
Ben64
01-29-2017 02:09 PM
ben64 a écrit :
It seems you didn't try my code because it does exactly what you want: add text to an existing TextBox.
Now if your TextBox contains prefilled text you can:
1- use the TextRange InsertAfter method to append text to the prefilled text or
2- read the TextBox text using the TextRange Text property, concatenate the result with the existing text and write it back again using the TextRange Text property.
Now if you try to use method 1 on an empty TextBox it will generate an error. So even if method 2 is a very little more work it will work without error even if the TextBox is initially empty.
Ben64
ERRATA: Method 1 (InsertAfter) will work even if the TexBox is initially empty. I used bad TextBox reference when I tried it and got error 97.
Ben64
01-29-2017 05:42 PM
Thank you so much.. I will try the code and update you ..
01-30-2017 01:36 PM - edited 01-30-2017 01:43 PM
I am wondering after InsertAfter and use my text.. why can't I set the font I want.. ?
Update:
Found it.. thanks
01-30-2017 04:01 PM
So what If I am trying to add text string to a text box with bullets.. I dont seem to be able to write the text after the specific bullets in the textbox...
01-30-2017 05:24 PM