PPT: Code to Change "White Areas" of Graphic to Transparent

ID: Q162857


The information in this article applies to:
  • Microsoft PowerPoint 97 For Windows
  • Microsoft PowerPoint 98 Macintosh Edition


SUMMARY

This article contains a sample Microsoft Visual Basic for Applications macro (Sub procedure) that changes all white areas of a selected graphic to transparent.

NOTE: This macro works best on black and white (1-bit) images. Gray-scale or color images may contain pixels that are off-white. This macro does not affect off-white pixels.


MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft Support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp

Sample Visual Basic Procedure


  Sub MakeTransparent()

      With ActiveWindow.Selection.ShapeRange
         .PictureFormat.TransparentBackground = msoTrue

      ' If you want to make a different color transparent, change the RGB
      ' values in the next line of code. For example, if you want to make
      ' black the transparent color, change:
      '
      '   RGB(255, 255, 255)
      '
      ' to
      '
      '   RGB(0, 0, 0)
      '
         .PictureFormat.TransparencyColor = RGB(255, 255, 255)
         .Fill.Visible = msoFalse
      End With
   End Sub 


REFERENCES

For more information about creating Visual Basic for Applications macros, click the Office Assistant in Microsoft PowerPoint, type how to create a macro, click Search, and then click to view "Create a macro in Visual Basic Editor."

For more information about running Visual Basic for Applications macros, click the Office Assistant in Microsoft PowerPoint, type how to run a macro, click Search, and then click to view "Run a macro."

NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If the Assistant is not able to answer your query, please see the following article in the Microsoft Knowledge Base:

Q176476 OFF: Office Assistant Not Answering Visual Basic Questions
For more information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:
Q163435 VBA: Programming Resources for Visual Basic for Applications

Additional query words: 8.00 kbualink97 ppt8 vba vbe powerpnt ppt8.0 macppt mac_ppt ppt98 powerpt GIF TIFF TIF TGA TARGE clear program programming

Keywords : kbcode kbmacro kbprg kbdta kbdtacode kbpptvba
Version : MACINTOSH:; WINDOWS:
Platform : MACINTOSH WINDOWS
Issue type : kbhowto


Last Reviewed: November 9, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.