I have a VBA code as below. I want to add this into the Invoke Activity.
How to declare arguments in the Invoke Activity ?
I dont know how to create arguments for this code work normally in the invoke code activity.
Thanks in advance!
Dim strTest As String
Dim strLen As Integer
strTest = “INV”
strLen = Len(strTest)
For Each Cell In Sheet6.Range(“E5:U23”)
If InStr(Cell, strTest) > 0 Then
Cell.Characters(InStr(Cell, strTest), strLen).Font.Color = vbRed
Cell.Characters(InStr(Cell, strTest), strLen).Font.Bold = True
End If
Next
First, your VBA code should accept input arguments:
Public Function Test(strTest as String) as String
Dim strLen As Integer
strTest = “INV”
strLen = Len(strTest)
For Each Cell In Sheet6.Range(“E5:U23”)
If InStr(Cell, strTest) > 0 Then
Cell.Characters(InStr(Cell, strTest), strLen).Font.Color = vbRed
Cell.Characters(InStr(Cell, strTest), strLen).Font.Bold = True
End If
Next
End function
Then parse the parameters to the VBA code as follows:
I want to use my VBA code as below to find and highlight special text “INV” within range “A2:A4” .
Pls try to create your xaml file by using invoke code activity inside .
Thanks you so much!
Dim strTest As String
Dim strLen As Integer
strTest = “INV”
strLen = Len(strTest)
For Each Cell In Sheet1.Range(“A2:A4”)
If InStr(Cell, strTest) > 0 Then
Cell.Characters(InStr(Cell, strTest), strLen).Font.Color = vbRed
Cell.Characters(InStr(Cell, strTest), strLen).Font.Bold = True
End If
Next