Hi, I am getting following error:
This is my coding
Sub MyVBA()
Set PSheet = Worksheets(“PivotTable”)
Set DSheet = Worksheets(“Filtered Data”)
'Define Data Range
LastRow = DSheet.Cells(Rows.Count, 1).End(xlUp).Row
LastCol = DSheet.Cells(1, Columns.Count).End(xlToLeft).Column
Set PRange = DSheet.Cells(1, 1).Resize(LastRow, LastCol)
'Define Pivot Cache
Set PCache = ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=PRange)
'Insert Blank Pivot Table
Set PTable = PCache.CreatePivotTable(TableDestination:=PSheet.Cells(1, 1), TableName:=“RezPivot”)
PTable.ClearTable
'Add Fields
Set pt = PSheet.PivotTables(“RezPivot”)
With pt
.PivotFields(“WAVE DESCRIPTION”).Orientation = xlRowField
.PivotFields(“STATUS”).Orientation = xlColumnField
.PivotFields(“AMOUNT”).Orientation = xlDataField
End With
End Sub
If I run this file from ExcelàDeveloper TabàVisual Basicàrun
It runs the file and create PivotTable on PivotTable Sheet
- I have Macro Enabled file
- The file has .xlsm extension.
- Code is saved with the name .txt extension
- I enabled all macros from Trust Center
Hey @khooshbu.jani
Did you also choose Enable All in the scope activity?
Thanks
#nK
yes. MacroSetting is EnableAll
Please help
this code inside VBAFile.txt
Do you have the MyVBA
function in the VBScript code you are reading at that point ?
Yes I do have it.
I also tried MyVBA with different extensions.
.vb , .vbs, .txt
nothing is helpful
it is runing from excel but when i invoke that from Uipath it gives me the error
jack.chan
(Jack Chan)
8
what version is your uipath.excel.activities?
and in VBAFile.txt can you change your code to this? (backup old version first)
FunctionMyVBA()
Set PSheet = Worksheets("PivotTable")
Set DSheet = Worksheets("Filtered Data")
'Define Data Range
LastRow = DSheet.Cells(Rows.Count, 1).End(xlUp).Row
LastCol = DSheet.Cells(1, Columns.Count).End(xlToLeft).Column
Set PRange = DSheet.Cells(1, 1).Resize(LastRow, LastCol)
'Define Pivot Cache
Set PCache = ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=PRange)
'Insert Blank Pivot Table
Set PTable = PCache.CreatePivotTable(TableDestination:=PSheet.Cells(1, 1), TableName:="RezPivot")
PTable.ClearTable
'Add Fields
Set pt = PSheet.PivotTables("RezPivot")
With pt
.PivotFields("WAVE DESCRIPTION").Orientation = xlRowField
.PivotFields("STATUS").Orientation = xlColumnField
.PivotFields("AMOUNT").Orientation = xlDataField
End With
End Function
I tried using function, instead of Procedure. But It is giving same error .
UiPath.Excel.Activity - it is the same verison I have 2.12.3
jack.chan
(Jack Chan)
10
can you send your project file as a zip @khooshbu.jani