Du hast meine Dimensionierungen weggelassen
Dim oldname(0) As String
Dim newname(0) As String
Was Replace mit Arrays veranstaltet sagt die Hilfe:
Replace(sourceArray as Variant, findArray as Variant, replacementArray as Variant[, start as Integer[, count as Integer[, compMethod as Integer]]]) as Variant
Elements
sourceArray
Array of type String containing the strings to be modified
replaceArray
Array of type String containing the words or phrases to be replaced
replacementArray
Array of type String containing the replacement words or phrases
start
optional Integer specifying the character position to start at in each String
count
optional Integer specifying the maximum number of replacements to make.
compMethod
Optional Integer specifying the type of comparison to use when searching for the delimiter, if the elements are strings.
Number Comparison Mode
0 case sensitive, pitch sensitive
1 case insensitive, pitch sensitive
4 case sensitive, pitch insensitive
5 case insensitive, pitch insensitive
If you omit compMethod, the default comparison mode is the mode set by the Option Compare statement for this module. If there is no statement for the module, the default is case sensitive and pitch sensitive.
Return value
Replace returns an Array of type String that contains sourceArray, where any values in replaceArray have been replaced by the corresponding values in replacementArray.
Usage
Replace searches the String in sourceArray for the String in replaceArray. If a match is found, the substring is replaced with a corresponding substring from replacementArray. Each String in replaceArray is scanned against each String in sourceArray as modified by prior substitutions. Replace is case sensitive.
If no matches are found, then a copy of sourceArray is returned.
If more strings are specified in replaceArray than in replacementArray, the extra strings in replaceArray are replaced with the last string in replacementArray. Extra strings in replacementArray are ignored.
Andreas