VBA PowerPoint AnyoneReplace Exisiting Pictures in New Format?

In summary, the conversation discusses using VBA code to convert MS Excel Worksheet Objects to Bitmap images in a PowerPoint presentation. The first step is to select each of the images, which can be done using a loop through the shape collection of the slide and then using the ConvertToInlineShape() method. The size of the images can also be adjusted using the ScaleWidth and ScaleHeight methods.
  • #1
Saladsamurai
3,020
7
Okay. Here's a good one: I recently used a PowerPoint pres to organize a bunch
of Data from Excel. I have about 100 slides that have 4 Objects on each slide.

Each Object is a Copy/Paste Special of a Range from an Excel spreadsheet. Unfortunately, in my
haste I Paste Specialed them all as MS Excel Worksheet Objects. These use
a lot of memory.

I would like to write a VBA code that will go through each slide, select each
object and convert it to a Bitmap.

Any ideas on this one?

How about the first step: How do I get PPT to select each of the 4 images? (or even ALL
of them simultaneously.

Note that the Objects are not the only things on each slide.
 
Technology news on Phys.org
  • #2
Yes, you could use a loop to go through each slide and select the objects. You can get the shape collection of the slide and loop through it, selecting each object. Then, you can use the shape.ConvertToInlineShape() method to convert it to a Bitmap image. Finally, you can use the shape.ScaleWidth and shape.ScaleHeight methods to scale the size of the image.
 
  • #3


Hello there,

Thank you for sharing your experience with using PowerPoint to organize data from Excel. It sounds like you have a large number of slides and objects, and you are looking for a way to efficiently convert them to a more manageable format.

One potential solution is to use VBA (Visual Basic for Applications) code to automate the process of selecting and converting the objects. VBA is a programming language that is built into Microsoft Office applications, including PowerPoint. It allows you to write custom code to perform specific tasks within the program.

To get started, you will first need to open the Visual Basic Editor in PowerPoint. This can be done by clicking on the "Developer" tab in the ribbon and then clicking on "Visual Basic" in the "Code" group. Once the editor is open, you can create a new module to write your code in.

To select all of the objects on a slide, you can use the "Shapes" property of the slide object. This property returns a collection of all the shapes on the slide, which you can then loop through to perform actions on each one. For example, you could use a "For Each" loop to go through each shape and check its type. If it is an Excel object, you can then use the "ConvertToBitmap" method to convert it to a bitmap.

It is important to note that the specific code you will need to write will depend on your specific situation and the structure of your slides and objects. You may need to experiment and adjust the code to fit your needs.

I hope this helps get you started on finding a solution for your task. If you need further assistance, you may want to consider reaching out to a VBA expert or consulting online resources for more specific guidance.

Best of luck with your project!

Sincerely,
 

Related to VBA PowerPoint AnyoneReplace Exisiting Pictures in New Format?

1. Can I use VBA to replace existing pictures in a PowerPoint presentation with a new format?

Yes, VBA (Visual Basic for Applications) can be used to automate tasks in PowerPoint, including replacing pictures with a new format. This can save time and effort when making large changes to a presentation.

2. How do I write VBA code to replace pictures in PowerPoint?

To replace pictures in PowerPoint using VBA, you can use the Replace method. This method allows you to specify the old picture and the new picture to be inserted in its place. You can also use loops and conditionals to make the code more efficient and dynamic.

3. Can VBA replace multiple pictures at once in PowerPoint?

Yes, VBA can replace multiple pictures at once in PowerPoint. You can use a loop to go through each slide in the presentation and replace pictures based on certain criteria, such as file name or file type. This allows for bulk changes in a presentation.

4. Is it possible to replace pictures in PowerPoint with a specific size or aspect ratio?

Yes, using VBA, you can specify the size or aspect ratio of the new pictures to be inserted. This can be useful when you want to maintain consistency in the presentation or need to fit the pictures into a specific layout or design.

5. Do I need any special skills or knowledge to use VBA for replacing pictures in PowerPoint?

Yes, you will need some basic knowledge of VBA programming and the PowerPoint object model to use VBA for replacing pictures in PowerPoint. This includes understanding variables, loops, and conditional statements, as well as the methods and properties of PowerPoint objects.

Similar threads

  • Feedback and Announcements
Replies
2
Views
1K
Replies
152
Views
5K
  • Cosmology
Replies
4
Views
2K
  • DIY Projects
Replies
23
Views
4K
Replies
42
Views
4K
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
12K
  • Introductory Physics Homework Help
Replies
11
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top