Skip to content

Instantly share code, notes, and snippets.

@wboykinm
Created April 24, 2012 18:11
Show Gist options
  • Save wboykinm/2482201 to your computer and use it in GitHub Desktop.
Save wboykinm/2482201 to your computer and use it in GitHub Desktop.
Deprecated ArcGIS symbology export
' ---- Adapted from Miles Hitchen at http://forums.esri.com/Thread.asp?c=93&f=1730&t=220177 ----
Public Sub UVRtoRGB()
' ---- Change this output location ----
Const OUTPUT_FILE = "C:\Miles\RGBValues.txt"
' -------------------------------------
Dim pMxDoc As IMxDocument
Dim pGeoFtrLyr As IGeoFeatureLayer
Dim pUVRend As IUniqueValueRenderer
Dim pFillSym As IFillSymbol
Dim pRGB As IRgbColor
Dim f As Long
Dim sVal As String
Set pRGB = New RgbColor
Set pMxDoc = ThisDocument
Set pGeoFtrLyr = pMxDoc.FocusMap.Layer(0)
Set pUVRend = pGeoFtrLyr.Renderer
Open OUTPUT_FILE For Output As #1
Print #1, "Value,Red,Green,Blue"
For f = 0 To pUVRend.ValueCount - 1
sVal = pUVRend.Value(f)
Set pFillSym = pUVRend.Symbol(sVal)
pRGB.RGB = pFillSym.Color.RGB
Print #1, sVal; ","; CStr(pRGB.Red); ","; CStr(pRGB.Green); ","; CStr(pRGB.Blue)
Next f
Close #1
MsgBox "RGBs Exported", vbInformation
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment