Excel hyperlink to web page location with id or named anchor
excel, hyperlink, vba
Solution
It appears to be a browser problem not an Excel problem. Switching from Google Chrome to Internet Explorer solved it.
Thanks everyone for your suggestions ... just saying that you didn't find the same problem was what prompted me to look elsewhere.
Problem
In Excel, I can create a hyperlink to a web page. However, if the URL contains a # character, Excel always converts the hash sign to space-hyphen-space so the link no longer works. The URL http://www.example.com/page#location becomes http://www.example.com/page%20-%20location I have tried three ways manually, right-click a cell, click "hyperlink" and type the URL in the address box programatically, providing the full URL: `Worksheets(1).Hyperlinks.Add Address:="http://www.example.com/page#location"` programatically, giving the location as a "subaddress": `Worksheets(1).Hyperlinks.Add Address:="http://www.example.com/page", SubAddress:="location"` All three give the same problem. Is it possible to create a link to a specific location (id or named anchor) not just to a web page? I would be grateful for any help. Note: the code examples are incomplete; for clarity, I have omitted the parameters Anchor and TextToDisplay. Excel version: 2010 (14.0.6126.5003) SP1