Hi Friends,
I am trying to update hyperlink in my excel using invoke code in uiPath.
Please find below the code for the same.
Dim xlApp As Microsoft.Office.Interop.Excel._Application = Nothing
Dim xlWorkBooks As Microsoft.Office.Interop.Excel.Workbooks=Nothing
Dim xlWorkBook1 As Microsoft.Office.Interop.Excel.Workbook=Nothing
Dim xlWorkSheet1 As Microsoft.Office.Interop.Excel.Worksheet=Nothing
Dim xlWorkSheets As Microsoft.Office.Interop.Excel.Sheets=Nothing
Dim xlRange As Microsoft.Office.Interop.Excel.Range=Nothing
Dim xlRanges As Microsoft.Office.Interop.Excel.Ranges=Nothing
xlApp=New Microsoft.Office.Interop.Excel.ApplicationClass
xlApp.DisplayAlerts=False
xlWorkBooks=xlApp.Workbooks
On Error Resume Next
xlWorkBook1=xlWorkBooks.Open(WorkbookPath1,UpdateLinks:=False)
If Err.Number>0 Then ErrorMsg = “Exception while opening source excel” : GoTo ErrExt
xlApp.Visible = True
On Error GoTo 0
On Error Resume Next
xlWorkSheet1=CType(xlWorkBook1.Sheets(SheetName1),Microsoft.Office.Interop.Excel.Worksheet)
If Err.Number>0 Then ErrorMsg = “Sheet " + SheetName1 + " does not exist.” & Err.Description : GoTo ErrExt
On Error GoTo 0
xlWorkBook1.ChangeLink(Name:= “C:\Users\Path1.xlsx”, NewName:= “C:\Users\Path2.xlsx” , Type:=Microsoft.Office.Interop.Excel.XlLinkType)
ErrorMsg = “No Error”
ErrExt:
xlApp.DisplayAlerts=True
xlWorkBook1.Save
xlWorkBook1.Close()
xlApp.Quit()
I get the below error after writing the above code.
Please help in resolving the same !!
Thanks,
Devi