Microsoft PowerPoint

Use VBA to insert a picture file onto a PowerPoint slide

VBA

Embeddings illustrations is a major piece of making most PowerPoint introductions. A great deal of illustrations are one of a kind to the slide and you utilize them just once. Be that as it may, different designs, for example, a logo, you may utilize frequently. Embeddings a similar document isn’t a major ordeal in light of the fact that the procedure is simple, yet there’s no motivation to work harder than you should. On the off chance that you have a realistic record you embed frequently, robotize the procedure utilizing a VBA methodology (large scale), as takes after:

  1. In PowerPoint, dispatch the Visual Basic Editor by squeezing [Alt]+[F11].
  2. Pick Module from the Insert menu.
  3. Enter the accompanying subprocedure:

Sub InsertLogo()

‘Embed TR logo.

ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _

FileName:=”C:\Active\TR\September2009Blog\TR.jpg”, _

LinkToFile:=msoFalse, _

SaveWithDocument:=msoTrue, Left:=60, Top:=35, _

Width:=98, Height:=48).Select

End Sub

Make certain to refresh the filename and way for the FileName contention. The Left and Top qualities enter the logo record in the upper left corner of the present slide. You should seriously mull over utilizing the full scale recorder to give the area and measurement esteems, however in all likelihood, you’ll need to change the outcomes.

To run the large scale, select a slide and pick Macro from the Tools menu. At that point, pick Macros, select InsertLogo, and snap Run. PowerPoint will embed the realistic record in the upper left corner of the present slide.

In the event that the document isn’t in the predefined organizer, the full scale will produce a mistake, so you’ll need to suit that probability. Furthermore, in the event that you have a few documents you embed every now and again, you should need to utilize a capacity rather than a subprocedure. That way, you can pass filenames as takes after:

ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _

FileName:=gfilename, _

LinkToFile:=msoFalse, _

SaveWithDocument:=msoTrue, Left:=60, Top:=35, _

Width:=98, Height:=48).Select

End Function

The passed string, gfilename, must determine the whole pathname if the record isn’t in an indistinguishable envelope from the introduction document.

For Recommended Posts Visit: office com setup

Leave a Reply

Your email address will not be published. Required fields are marked *