Quote:@BNotr I am using the following code it creates Hyperlink and add it to the given location its giving error "Reference not valid" //Code Snippet private void AddHyperLink(Workbook xlWorkBook,int nfaultCount) { Excel.Worksheet xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); DateTime now = DateTime.Now; xlWorkSheet.Name = "Summary"; xlWorkSheet.Cells[3, 2] = "SnapShot Details"; xlWorkSheet.Cells[3,2].EntireRow.Font.Bold = true; xlWorkSheet.Range[xlWorkSheet.Cells[3, 1], xlWorkSheet.Cells[3, 2]].Merge(); //code to merge cells xlWorkSheet.Select(Type.Missing); xlWorkSheet.Cells[6, 1] = "Snapshot taken at"; xlWorkSheet.Cells[6, 2] = now; xlWorkSheet.Cells[8, 1] = "Click on the Hyperlinks below to navigate to the corresponding sheet"; xlWorkSheet.Range[xlWorkSheet.Cells[8, 1], xlWorkSheet.Cells[8, 6]].Merge(); //code to merge the cells xlWorkSheet.Cells[8, 1].EntireRow.Font.Bold = true; for (int i = 1; i <= nfaultCount; i++) { int x = i + 9; string str = "Fault Code "+i + " of " + nfaultCount; //Test link as string strRange1 = "A" + x; string strRange2 = "A" + x; string strRange = strRange1 + ":" + strRange2; //Location of link var Range = xlWorkSheet.get_Range(strRange); // strRange1 = "!" + strRange1; // i+" of "+nfaultCount name of target worksheet string strp="#" + i + " of " +nfaultCount + strRange1; Range.Cells.Hyperlinks.Add(Range,strp, Type.Missing, "Fault Code Link", str); } xlWorkSheet.Columns["A:B"].AutoFit(); } Kindly help me out
hyperlinkCell.Hyperlink.Location = "'" + sheetName.ToString() + "'" + "!A1";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)