Sub CollarRemove() ' Macro by Dave Kazmer, USDA, Sidney, Montana, 2006. ' Makes the white color of the DRG TIFF images in an ' ArcMap data frame transparent. 'NOTE FOR ARCMAP 8 USERS: ' This script was written for ArcMap 9 and does not work for ' earlier versions. The Arc 8 version of this script is at ' http://dn.msl.mt.gov/Geographic_Information/Data/Topographic/drgtransparent8.txt ' To run this macro, open the Visual Basic editor, open ' "ThisDocument" in the ArcMap Objects folder of your Project, ' paste the text from this file into it, and then push the ' Run button. Dim pMxDoc As IMxDocument Dim pLy As ILayer Dim pRasLy As IRasterLayer Dim pRaster As IRaster Dim pUVRend As IRasterUniqueValueRenderer Dim pRasRend As IRasterRenderer 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 'Get the layer renderers and change symbol 1 to transparent. Set pRasLy = pLy Set pRaster = pRasLy.Raster Set pUVRend = New RasterUniqueValueRenderer Set pRasRend = pUVRend Set pRasRend.Raster = pRaster pRasRend.Update pUVRend.Symbol(0, 1) = pSym pRasRend.Update Set pRasLy.Renderer = pUVRend End If Next iNum Set pColor = Nothing Set pSym = Nothing pMxDoc.ActiveView.Refresh End Sub