-
FlexPro
- Zoom sur FlexPro
- Fonctionnalités & Options
- Domaines d’application
- Tous les avantages
- Nouveau dans FlexPro 2021
- Testez FlexPro gratuitement
- FlexPro View OEM Freeware
- Conseils d’achat
- Login
- Langue
- +49 6894 929600
- infoweisang.com
- Google Maps
- Produits
- News
- Support
- Société
- Emplois
- Contact
- Login
- Langue
- +49 6894 929600
- infoweisang.com
- Google Maps
Accueil > Community > General > Find & Replace > Reply To: Find & Replace
February 8, 2016 at 9:20 am
#9426
Bernhard Kantz
Participant
Since the names to change occur in many different locations, it is no easy task. The following example just handles object names, formula contents and datasets for 2d diagrams.
Option Explicit
Const csSearch As String = "Jan"
Const csReplace As String = "01"
Public Sub SearchReplace()
Visit ThisDatabase.RootFolder
End Sub
Private Sub Visit(ByRef oFld As Folder)
Dim cllObs As FpObjects
Set cllObs = oFld.Objects
Dim oObj As FpObject
For Each oObj In cllObs
Select Case oObj.ObjectType
Case fpObjectTypeFolder
Visit oObj
Case fpObjectTypeFormula
VisitFormula oObj
Case fpObjectType2DDiagram
VisitDiagram2D oObj
End Select
' rename object itself
Dim sNewName As String
sNewName = Replace(oObj.Name, csSearch, csReplace)
If sNewName oObj.Name Then
oObj.Rename sNewName, fpRenamingOptionsDontCorrectReferences
End If
Next oObj
End Sub
Private Sub VisitFormula(ByRef oFml As Formula)
oFml.Formula = Replace(oFml.Formula, csSearch, csReplace)
End Sub
Private Sub VisitDiagram2D(ByRef oDiag2D As Diagram2D)
Dim oCurve As Curve2D
For Each oCurve In oDiag2D.Curves
With oCurve.Data
.DataSet = Replace(.DataSet, csSearch, csReplace)
.XDataSet = Replace(.XDataSet, csSearch, csReplace)
End With
Next oCurve
End Sub