We have a problem that we have some files which have many "hard-referenced" raster files have been attached. I need to suppress the original location so that MS_RFDIR can supply the location. As an intermediate step, I am trying to change the path as follows:
For Each oRaster In theRasters If oRaster.RasterInformation.Path = "T:\2346 Eldon Square Newcastle Phase 3\Images\Statutory Signage" Then sPath = oRaster.RasterInformation.Name sPath = "H:\2346 Eldon Square Newcastle Phase 3\Images\Statutory Signage\" & sPath oRaster.SetAttachName sPath i = i + 1 End If Next
Which fails to work. SetAttachName requires
oRaster.SetAttachName(sPath) 'according to AutoComplete
But no brackets needed according to VBA help. Presumably the raster ref should then be re-written.
Either way I would really appreciate some help with a method to replace raster reference paths..
Thanks in advance
Mike
Everybody,
The basic logic for this macro has now worked and the final version is as below... please note that I had to add On Error Resume Next to make it work. Suggest that this might be due to some of the names for the rasters which contained "[xx]". The "hard-wired" raster path has been supplanted by the file name alone and the path for the rasters is now supplied by MS_RFDIR, which is what we want.
Option Explicit Dim theRasters As Rasters Dim oRaster As raster Dim i As Long Dim sPath As String Sub Main() Set theRasters = RasterManager.Rasters For Each oRaster In theRasters If oRaster.RasterInformation.Path = "T:\2346 Eldon Square Newcastle Phase 3\Images\Statutory Signage" Then sPath = oRaster.RasterInformation.Name 'Debug.Print sPath On Error Resume Next oRaster.SetAttachName sPath 'works i = i + 1 End If Next Debug.Print "rasters processed: " & i End Sub
Option Explicit Dim theRasters As Rasters Dim oRaster As raster Dim i As Long Dim sPath As String
Sub Main()
Set theRasters = RasterManager.Rasters
For Each oRaster In theRasters If oRaster.RasterInformation.Path = "T:\2346 Eldon Square Newcastle Phase 3\Images\Statutory Signage" Then sPath = oRaster.RasterInformation.Name 'Debug.Print sPath On Error Resume Next oRaster.SetAttachName sPath 'works i = i + 1 End If Next Debug.Print "rasters processed: " & i
End Sub