From: Lars-�ke Aspelin on 25 Apr 2010 02:39 Powerpoint 2003. I have an Add-in with an Auto_open() sub that creates a custom toolbar with some buttons that fire different macros that is included in the Add-in. One macro moves around existing shapes (images) in the ppt presentation and that works fine as long as the shapes are there. But if the user has deleted a shape from the presentation, the macro will fail. What I would like to do is to incorporate some shapes (images) in the Add-in (.ppa) and make them available to the Add-in macro so it can copy the shapes into the presentation when needed. Appreciate any advice on how to accomplish this. Lars-�ke
From: Steve Rindsberg on 25 Apr 2010 12:44 In article <p2o7t5p2fvnvqto5f70td5o7cmtap6o3jp(a)4ax.com>, Lars-�ke Aspelin wrote: > Powerpoint 2003. > > I have an Add-in with an Auto_open() sub that creates a custom toolbar > with some buttons that fire different macros that is included in the > Add-in. > > One macro moves around existing shapes (images) in the ppt > presentation and that works fine as long as the shapes are there. But > if the user has deleted a shape from the presentation, the macro will > fail. > > What I would like to do is to incorporate some shapes (images) in the > Add-in (.ppa) and make them available to the Add-in macro so it can > copy the shapes into the presentation when needed. > > Appreciate any advice on how to accomplish this. I'll fill in the general outlines; if you need details on how to make it work, let us know. I would tag the shapes that you want to work with so that they're easy for your macro to find. I'd also write a little function that hands back a reference to the shape with the tag you're after. I already did, in fact. It's here: Working with Tags (and a bit about Functions) http://www.pptfaq.com/FAQ00815.htm There's also an example of how to use the function which includes a test to see if the function returned nothing ... ie the requested shape wasn't there. If it's not there, your code could add the needed image to the slide. You could store the images along with the add-in itself and include a bit more code to get the correct path to the images, basically just: Addins("your_addin_name").Path Storing the images within the add-in itself would be more complicated. You might do something like this: Write a routine that reads the data from an image file as binary then writes out the value of each byte as a string to a file. Open the file in notepad and paste it into something like this: Dim sFileData as String sFileData="4298374058372.....2748503" where the numbers represent the ascii values of the bytes in your images. To use this, you'd convert the data back to binary and write it to a temp file, import the temp file into PPT, then delete it. I think the editor may impose limits on how much data you can tack onto a string in this way, so you might need to break it into chunks and handle it as an array of strings or the like. ============================== PPT Frequently Asked Questions http://www.pptfaq.com/ PPTools add-ins for PowerPoint http://www.pptools.com/
From: Lars-�ke Aspelin on 25 Apr 2010 17:46 On Sun, 25 Apr 2010 12:44:41 -0400, Steve Rindsberg <abuse(a)localhost.com> wrote: >In article <p2o7t5p2fvnvqto5f70td5o7cmtap6o3jp(a)4ax.com>, Lars-�ke >Aspelin wrote: >> Powerpoint 2003. >> >> I have an Add-in with an Auto_open() sub that creates a custom toolbar >> with some buttons that fire different macros that is included in the >> Add-in. >> >> One macro moves around existing shapes (images) in the ppt >> presentation and that works fine as long as the shapes are there. But >> if the user has deleted a shape from the presentation, the macro will >> fail. >> >> What I would like to do is to incorporate some shapes (images) in the >> Add-in (.ppa) and make them available to the Add-in macro so it can >> copy the shapes into the presentation when needed. >> >> Appreciate any advice on how to accomplish this. > >I'll fill in the general outlines; if you need details on how to make it >work, let us know. > >I would tag the shapes that you want to work with so that they're easy >for your macro to find. I'd also write a little function that hands >back a reference to the shape with the tag you're after. I already did, >in fact. It's here: > >Working with Tags (and a bit about Functions) >http://www.pptfaq.com/FAQ00815.htm > >There's also an example of how to use the function which includes a test >to see if the function returned nothing ... ie the requested shape >wasn't there. > >If it's not there, your code could add the needed image to the slide. >You could store the images along with the add-in itself and include a >bit more code to get the correct path to the images, basically just: > >Addins("your_addin_name").Path > >Storing the images within the add-in itself would be more complicated. > >You might do something like this: > >Write a routine that reads the data from an image file as binary then >writes out the value of each byte as a string to a file. > >Open the file in notepad and paste it into something like this: > >Dim sFileData as String > >sFileData="4298374058372.....2748503" >where the numbers represent the ascii values of the bytes in your >images. > >To use this, you'd convert the data back to binary and write it to a >temp file, import the temp file into PPT, then delete it. > >I think the editor may impose limits on how much data you can tack onto >a string in this way, so you might need to break it into chunks and >handle it as an array of strings or the like. > > > >============================== >PPT Frequently Asked Questions >http://www.pptfaq.com/ > >PPTools add-ins for PowerPoint >http://www.pptools.com/ > Thanks for you suggestions. The refering to shapes in the ppt is not a problem. Tags seem convenient, but as I don't have a need for more than one "tag" per shape I guess the use of "index by name" for refering a shape works well. I have tried the proposal with image file(s) along, i.e. in the same directory as, the Addin, but it would be very nice to have everything in the .ppa file in order to eliminate the risk of these extra files being lost. As I can have images in user forms that are "embedded" in the Add-in (.ppa-file) itself, I was kind of hoping that I could reference these images by <something>.Userform1.Image1.Picture without having to use the low level binary alternative that you suggested. Any ideas on what <something> could be? Lars-�ke
From: Steve Rindsberg on 25 Apr 2010 22:29 > The refering to shapes in the ppt is not a problem. Tags seem > convenient, but as I don't have a need for more than one "tag" per > shape I guess the use of "index by name" for refering a shape works > well. Names aren't entirely trustworthy, but if it's a presentation that users won't be editing and you have fairly tight control over it, names might be fine. > I have tried the proposal with image file(s) along, i.e. in the same > directory as, the Addin, but it would be very nice to have everything > in the .ppa file in order to eliminate the risk of these extra files > being lost. > > As I can have images in user forms that are "embedded" in the Add-in > (.ppa-file) itself, I was kind of hoping that I could reference these > images by > <something>.Userform1.Image1.Picture without having to use the low > level binary alternative that you suggested. > > Any ideas on what <something> could be? It's simple in VB forms where you have a clipboard object you can copy the picture to. There's no VBA clipboard object though. I've poked around a bit and couldn't find anything useful immediately. Let's see if someone else has any ideas. ============================== PPT Frequently Asked Questions http://www.pptfaq.com/ PPTools add-ins for PowerPoint http://www.pptools.com/
From: Matti Vuori on 26 Apr 2010 05:34 Lars-�ke Aspelin <larske(a)REMOOVEtelia.com> wrote in news:p2o7t5p2fvnvqto5f70td5o7cmtap6o3jp(a)4ax.com: > What I would like to do is to incorporate some shapes (images) in the > Add-in (.ppa) and make them available to the Add-in macro so it can > copy the shapes into the presentation when needed. Nothing stops you from distributing the PPT version of your add-in also. It would be easiest for maintenance of the shape collection and testing. In you add-in, you just figure out where the add-in is, open the corresponding .ppt file (invisibly) and reference the shapes in any way you like.
|
Next
|
Last
Pages: 1 2 Prev: EFFECT OPTION UNDER DESIGN RIBBON Next: how to remove sound from PowerPoint file? |