Blue Prism Product

Product_Community.jpg
Expand all | Collapse all

Add columns to excel, Color Cell using Code in BP

  • 1.  Add columns to excel, Color Cell using Code in BP

    Posted 06-06-2018 13:08
    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  


  • 2.  RE: Add columns to excel, Color Cell using Code in BP

    Posted 08-13-2020 18:21
    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
    ------------------------------