cancel
Showing results for 
Search instead for 
Did you mean: 

Add columns to excel, Color Cell using Code in BP

Anonymous
Not applicable
Hi Team,  I am trying to perform the following actions in blueprism   Add columns to excel - used to add a new column at position D Color Cell - used to change the background color of cell   I am adding them as a code stage in a new action in Excel VBO object. Please review the code and suggest on how to correct them, or what code should be used to perform the required functions.     Color Cell   Dim RR As Object Dim excel As Object Try RR = GetWorksheet(Handle, WorkBookName, WorkSheetName) RR.Activate() excel = RR.Application   RR.UsedRange.Select()   RR.Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red) RR.Cells(1, 2) = "Red" Success = True Catch e As Exception Success = False Message = e.Message End Try   Filter Cell 'Dim Selection as Range 'Dim excel As Object Dim Columns as Object Dim RR As Object Try RR = GetWorksheet(Handle, WorkBookName, WorkSheetName) RR.Activate() 'excel = RR.Application   RR.UsedRange.Select()  Columns("D:D").Insert(Shift:=-4161, CopyOrigin:=0) 'Range("D1").Value = "Loc" 'Selection.Insert(Shift:=-4161, CopyOrigin:=0) 'Selection.Insert(Shift:=-4161, CopyOrigin:=0) Success = True Catch e As Exception Success = False Message = e.Message End Try  
1 REPLY 1

InJoeKhor
Staff
Staff
Hi Prateek,

One of the many ways is you can check the value of the cell using  Go To Next Cell from the MS Excel VBO until you find the column with the header name you desire. Once you have identified the column, you can use the Insert Column(s) action to insert the new column.

Hope this helps.

Thanks

------------------------------
In Joe Khor
Sr. Product Consultant
Blue Prism
------------------------------
In Joe Khor Sr. Product Consultant Blue Prism