0

With Excel VBA I use Bitly API to shorten long links. The macro ran perfectly and I was able to convert all the long links into short ones. Now, when I copy/paste these links to browser, they work fine, example http://bit.ly/1FVcuRx but when I use them with:

 =HYPERLINK(A1, 2)  

where A1 = http://bit.ly/1FVcuRx, and then I click on it, it errors: "cannot find [some file, local directory]".

I am not sure how can I make it work, as the link works fine but the hyperlink doesn't work with it.

Also, I noticed one thing, for the shorter links (less than 255 characters), when I ran macro, the Bitly link works fine with HYPERLINK function.

11
  • Using Excel 2013 on Windows 7, the formula works just fine for me.
    – zedfoxus
    Oct 7, 2015 at 16:02
  • I am using 2016. with windows 8.1 . I dont have excel 2013. is there any way i can test it. Also, did you click on the cell where =hyperlink("link",1) is? Did it take you to the browser? Oct 7, 2015 at 16:04
  • If you replace cell A1 with google.com, does it function fine? If so, do you have any web-proxy or network monitoring tool that might be an issue?
    – zedfoxus
    Oct 7, 2015 at 16:06
  • yes, it works fine with google.com or other shorter links. I am wondering is it because, the the bitly link( that I posted above) was formed from link >500 characters? Oct 7, 2015 at 16:08
  • I think something's going on with the browser. Can you default your browser to firefox, chrome and IE and check if this issue can be isolated to only a specific browser? Then, just copy the text bit.ly/1FVcuRx and paste it in your current default browser and see if that works.
    – zedfoxus
    Oct 7, 2015 at 16:09

2 Answers 2

1

Its seems like there are issue with excel 2013 and excel 2016( from office 365). I tried it with google docs and excel 2013 (regular edition) and it worked fine.

1
  • Great find. Thank you for publishing your findings. If you can, please feel free to mark your answer as accepted to give closure to this question.
    – zedfoxus
    Oct 7, 2015 at 18:36
0

Your code ~=HYPERLINK(A1, 2) ~ works fine on my excel 2016 from Office 365. Alternatively you can turn these tiny urls to clickable hyperlinks with the following code. I have uploaded a sample file to dropbox also.https://www.dropbox.com/s/52vl33rma7468no/test_0910_2015b.xlsm?dl=0

Sub ConvertToHyperlinks()
  Dim Rng As Range
  Dim WorkRng As Range
  On Error Resume Next
  Set WorkRng = Application.Selection
  Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
  For Each Rng In WorkRng
    Application.ActiveSheet.Hyperlinks.Add Rng, Rng.Value
  Next
End Sub
4
  • something is wrong with my excel version. When i downloaded your file and click on the hyperlinks and link, it goes to "file:///C:/Users/arpit/AppData/Local/Microsoft/Windows/INetCache/IE/5G5BWT56/pubmed%5B1%5D.htm" . Does it ring any bell? Instead of going to actual link, it goes to some local file? Its the same problem i had earlier Oct 11, 2015 at 21:17
  • Excel 2013 and later version 2016 should be installed after removing previous versions of Office. I have seen conflict issues reported in various forums.
    – skkakkar
    Oct 11, 2015 at 21:27
  • I am using window 8.1 . I am not sure if its excel issue. I tried in my frnds laptops having 2013 edition and windows 10, it had same issue. But frnds with windows 7 with excel 2013 edition, it worked fine there. Oct 12, 2015 at 2:10
  • Please raise this issue in ms community forum for better resolution of the problem.
    – skkakkar
    Oct 12, 2015 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.