Search code examples
vbamicrostrategy

Type mismatch, when trying to get a variable in the sendkeyin command


I am using VBA in microstation to come up with a simple find & replace program. I keep getting a type mismatch where my & Text_Find and & Text Replace is. Any help would be greatly appreciated.

Sub Main()


Dim Find_text() As String
Dim Replace_text() As String

Find_text = Split("20.50 35.43", " ")
Replace_text = Split("12.5 43.55", " ")

'   Start a command

    CadInputQueue.SendKeyin "MDL KEYIN FINDREPLACETEXT,CHNGTXT CHANGE DIALOGTEXT"

For i = 0 To UBound(Find_text)
    For j = 0 To UBound(Replace_text)

    MsgBox Find_text
    MsgBox Replace_text

    CadInputQueue.SendKeyin "FIND DIALOG SEARCHSTRING" & Find_text

    CadInputQueue.SendKeyin "FIND DIALOG REPLACESTRING" & Replace_text

    CadInputQueue.SendKeyin "CHANGE TEXT ALLFILTERED"


    Next
Next

End Sub

Solution

  • Find_text and Replace_text are both arrays
    You will have to specify the element of the array to use
    Probably Find_text(i) Replace_text(j)