Extract by mask run time error in VBA

Discussion created by demdemeleeds on Dec 15, 2011
Latest reply on Dec 16, 2011 by sli-esristaff
I have the following script language code shown below within a main code just to run the tool of spatial analyst "Extract by mask". Unfortunately, when I run it I get a Run Time Error. I checked file names etc. but I cannot find the problem. Could anybody help me please? Thanks.

Dim GP As Object
Set GP = CreateObject("esriGeoprocessing.GpDispatch.1")

GP.AddToolbox "C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst  Tools.tbx"

InRaster = "C:\LACONISS\LandSpaCES\valuationmapr"
InMask = "C:\LACONISS\LandSpaCES\Parcel165"
OutRaster = "C:\LACONISS\LandSpaCES\ParcelR165"

GP.CheckOutExtension ("Spatial")

GP.ExtractByMask_sa InRaster, InMask, OutRaster