I’m trying to invoke two VBA in the UiPath workflow, and the wording is pretty much the same. But an error would occur when I try to invoke my second workflow. Do you know why?
Invoke VBA Activity 1:
Sub CleanSheet1()
' Declare variables
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Sheet1")
' Clear contents of sheet
ws.Cells.ClearContents
' Convert cells to text format
ws.Cells.NumberFormat = "@"
End Sub
Invoke VBA Activity 2:
Sub CleanSheet2()
' Declare variables
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Sheet2")
' Clear contents of sheet
ws.Cells.ClearContents
' Convert cells to text format
ws.Cells.NumberFormat = "@"
Please check the name of the macro if you provided exactly same as I dont see an issue here
Or please show the screenshot of bot the text file and the UiPath studio where you are invoking
And also you need not use teo different for this use an argument in place of sheets like below
Sub CleanSheet2(WBSheet as String)
' Declare variables
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets(WBSheet)
' Clear contents of sheet
ws.Cells.ClearContents
' Convert cells to text format
ws.Cells.NumberFormat = "@"
End Sub
And in invoke vba you can pass the sheetname value as input