How to Create a Hyperlink in Excel Spreadsheet Using VBScript

Someone at the newsgroup asked this question. This is the VBScript that I wrote to accomplish this.

Dim objExcel

Set objExcel = WScript.CreateObject("Excel.Application")

objExcel.Visible = TRUE

objExcel.Workbooks.Open "C:\\bintest.xls"



Dim sLinkAddress

sLinkAddress = ""

objExcel.Workbooks(1).Worksheets(1).Hyperlinks.Add _

    objExcel.Selection, sLinkAddress

objExcel.Workbooks(1).SaveAs "C:\\bintest.xls"


set objExcel = nothing
  • hi,

    I am trying to create a worksheet wherein you enter the web address of a site say ex: and upon entering the value, the cell should display only “XYZ” and not the entire web address. Upon clicking that cell, it should take us to that site.

    Can you please suggest some ways to do this?

    Thanks …

  • amida168


    I just tried it in Excel 2003. First, you enter into the cell. Then, click on the cell, enter xyz again. Now, the cell shows only xyz but it links to .

  • HelloWorld

    Peace people

    We love you

  • hey wen i try to run the script it showing wrong number of arguments or invalid property assignment and error code is 800a01c2. plz help

    • amida168

      The script is just an example. You can not just run it as it is. You need to modify it to suit your need.

  • raju singh

    i had tried to create hyperlink a doc file from excel sheet and it works fine