Add VBA code into invoke code activity

Hi Everyone.

I have a VBA code as below… The purpose of this VBA code to find & highlight special text “INV” which it found in cell by cell within range “A2:A4” in excel file.

I know how to use invoke VBA activity. But i dont know about the Invoke Code Activity and declare arguments .

Pls check and make a xaml file… i want to check and study from this.

Thanks in advance!

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

file.xlsx (8.0 KB)

Please don’t open a new topic for the same question.

Here you go, it should be what you need.

ExcelVBA.zip (24.4 KB)

2 Likes

Hi Bro @Cristian_Bardas

Thanks you but it not as my question.

I have known how to use Invoke VBA activity… But i dont know how to use Invoke Code Activity.

I want to use Invoke Code Activity for this case.

Thanks you so much!

Invoke Code is strictly for VB.NET code.
VBA runs on an Excel workbook. If you absolutely have to run VBA code on a workbook, it either needs to have that code in a Sub inside that workbook, or you can make an empty workbook and pack that code in it (adding enough code to open and close that other workbook)

3 Likes

Thanks you very much!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.