I’m trying to utilize the invoke code activity to run the following code:
Dim xlApp As New Excel.Application
Dim workbook As Excel.Workbook
Dim sheet As Excel.Worksheet
xlApp.Visible = True
workbook = xlApp.Workbooks.Open("exceldata.xlsx")
sheet = workbook.Worksheets(1)
sheet.Range("A1:B23").AutoFilter(Field:=2, Criteria1:="5", Operator:=Excel.XlAutoFilterOperator.xlTop10Items)
I am getting the following error:
I have added the Microsoft.Office.Interop,Excel on the imports tab. still have those errors.
Hope you can help.
From the looks of it you are trying to invoke the method .Visible on a String object, but the String Class doesn’t contain that method. You need to change your object type. Edit: I didn’t see that you already created the variables as excel objects. I would say check the variable pane and make sure it matches what you are wanting each variable to be.
Here is a link to some info about working with Excel application objects.
I found another workaround.
Anyways, thank you so much for your response
Feel free to share your workaround