Thursday, June 10, 2010

Hyperlink and Click in Excel Cell

'Just set the hyperlink for text in a Cell in Excel sheet and Click on that link

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True


Set objWorkbook = objExcel.Workbooks.Add


Set objWorksheet = objWorkbook.Worksheets(1)


objWorksheet.Cells(1, 1) = "Google Search"


Set objRange = objExcel.Range("A1")

'or

Set objRange = objExcel.Cells(2,2)



Set objLink = objWorksheet.Hyperlinks.Add (objRange,"http://www.google.com")


Set objRange = objExcel.Range("A1")

'or

Set objRange = objExcel.Cells(2,2)
objRange.Hyperlinks(1).Follow

No comments:

There was an error in this gadget