' Macro by Gerry Daumiller Montana State Library 5/1/2003 ' Makes the white color of the DRG TIFF images in an ' ArcMap data frame transparent. 'NOTE FOR ARCMAP 9 USERS: ' This script was written for ArcMap 8.3 and does not work for 9.0. ' The Arc 9 version of this script is at ' http://mslapps.mt.gov/Geographic_Information/Data/Topographic/drgtransparent9.txt ' To run this macro, open the Tools-Macros-Macros dialog, type a module ' and macro name into the "Macro Name" box (such as drg.Drgtrans), paste ' the text from this file into the Visual Basic editor between the ' "Sub Drgtrans()" and "End Sub" lines, close the Visual Basic editor, ' and use the Tools-Macros dialog to run the "drgtrans" macro. ' ArcMap will spend some time with each image saying ' "Building Tables", and will eventually come back and re-draw the images. Dim pMxDoc As IMxDocument Dim pLy As ILayer Dim pRasLy As IRasterLayer Dim pRasRend As IRasterUniqueValueRenderer Dim pSym As IColorSymbol Dim pColor As IRgbColor Dim iNum As Integer 'Make a transparent color and symbol. Set pColor = New RgbColor Set pSym = New ColorSymbol pColor.NullColor = True pSym.Color = pColor 'Cycle through the view and find all Tiff images Set pMxDoc = ThisDocument For iNum = 0 To pMxDoc.FocusMap.LayerCount - 1 Set pLy = pMxDoc.FocusMap.Layer(iNum) If TypeOf pLy Is RasterLayer And InStr(pLy.Name, ".tif") <> 0 Then Set pRasLy = pLy Set pRasRend = pRasLy.Renderer pRasRend.Symbol(0, 1) = pSym End If Next iNum Set pColor = Nothing Set pSym = Nothing pMxDoc.ActiveView.Refresh