VBA is setvalue GEOcoding. GCsinherited an illegal operation? and how to do other wise

I want to modify the properties of a raster so that the coordinate system of the model is inherited. The VBA crashes at the statement setvalue.

I get the error message illegal operation for this type (runtime error -2147220778 (800402d6)).
Is this not allowed ? and then how should it be done?

Public Sub RasterInheritGCS(oRaster As raster, bInheritGCSFromModel As Boolean) If TypeName(oRaster) <> "Raster" Then Exit Sub Dim sAccessStringNameToGet As String sAccessStringNameToGet = Replace(Trim("Geocoding.GCSInherited"), " ", "") Debug.Print sAccessStringNameToGet Dim oEl As Element Set oEl = RasterManager.Rasters.GetElementFromRaster(oRaster) Dim oPH As PropertyHandler Set oPH = CreatePropertyHandler(oEl) Dim sGCSInheritedbefore As String Dim sGCSInheritedafter As String sGCSInheritedafter = "Inherited" Debug.Print oRaster.RasterInformation.FileNameExploded If oPH.SelectByAccessString(sAccessStringNameToGet) Then Debug.Print "after" & sGCSInheritedafter sGCSInheritedbefore = oPH.GetValue Debug.Print "before" & sGCSInheritedbefore If sGCSInheritedbefore <> sGCSInheritedafter Then oPH.setValue ("Inherited") End If End Sub

regards Corina

Parents Reply Children