Excel Manipulations

Hi,

I need to use Blue Prism to do some manipulations in an Excel file like copying, filtering and writing the data, using the formulas, etc. which I hadn't tried before. As a first step to start with I used the code stage with the following code.

=====================================================
Dim sw, dw As Object
Dim ss, ds As Object
Dim excel, sheet As Object
dim Age as integer


Try

sw = excel.GetWorkbook(Handle, "C:\Worksheet in Basis.xlsx")
ss = excel.GetWorksheet(Handle, "C:\Worksheet in Basis.xlsx", "Sheet 1")


sw.Activate()
ss.Activate()
excel = ss.Application
sheet = excel.ActiveSheet


Age = 18
sheet.Range("T2:T600")=Age

Success = True

Catch e As Exception
Success = False
Message = e.Message
Finally
sw = Nothing
ss = Nothing
dw = Nothing
ds = Nothing
excel = Nothing
sheet = Nothing
============================================

I'm expecting Blue Prism to write the Age from cell T2 to T600. But, the BP object that I've created creates the Excel instance and opens the workbook, but does not write the age in the column T. Any help is much appriciated. Thanks in advance.
End Try
 
Hi VJ,

Thanks for the reply.

The above type works fine. Wanted to try it with using the code stage. It is not just pasting the data onto Excel, but involves some more calculations, changing the cell colors and formatting as well. So, thought of using codes and started with the simpler. But, couldn't identify what's wrong with it :(
 

VJR

Well-Known Member
Hi AAH,

sw = excel.GetWorkbook(Handle, "C:\Worksheet in Basis.xlsx")
ss = excel.GetWorksheet(Handle, "C:\Worksheet in Basis.xlsx", "Sheet 1")

excel = ss.Application
sheet = excel.ActiveSheet

The variable excel is used even before it is initialised.
 
Top