We are going to write the full Vb code, so before doing so you have to set these settings,
- Using Invoke Code Activity where you will write this code.
- Use these arguments just like it mentioned in below picture.
- Copy the code below and Paste it into your invoke code activity.
Try
app = New Microsoft.Office.Interop.Excel.ApplicationClass
workbook= app.Workbooks.Open(Filename.Trim)
RenameSuccessful=True
For Each worksheet In workbook.Sheets
If worksheet.Name = Sheetname.Trim Then
sheet_found = True
Exit For
Else
sheet_found = False
End If
Next
If sheet_found = True Then
worksheet = CType(workbook.Worksheets(Sheetname.Trim),Microsoft.Office.Interop.Excel.Worksheet)
worksheet.Name = NewWorkSheetName
workbook.Save
Else
RenameSuccessful=False
ErrorMsg="Sheet " & Sheetname.ToString & " not found in "& System.IO.Path.GetFileName(Filename).ToString &" File"
End If
workbook.Close()
app.Quit()
Catch ex As Exception
RenameSuccessful = False
ErrorMsg = ex.Message
Finally
gc.Collect()
gc.WaitForPendingFinalizers()
End Try
Happy Automation!!
It does not work. :|
ReplyDeleteIt works, make sure it is imported in your project
DeleteNew Microsoft.Office.Interop.Excel.ApplicationClass...
This is an amazing blog, thank you so much for sharing such valuable information with us.
ReplyDeleteUipath Training Hyderabad
Online Uipath Training
Uipath Course Online
Uipath Training in Delhi
Uipath Online Training Hyderabad
Uipath Course in Bangalore
RPA Uipath Online Training
Best Uipath Training in Hyderabad
Uipath Developer Training
Uipath Certification Training
Uipath Online
Uipath Online Course
RPA Uipath Training in Hyderabad