Reputation: 1634
I want to create a button in Excel which links to:
http://datafeed.api.productserve.com/datafeed/download/apikey/50f70c7de11f99fe127d7ad4c8e37e31/cid/97,98,142,144, ... ,567,569/fid/4319/columns/merchant_product_id,merchant_category,brand_name,product_name,mpn,search_price,aw_deep_link,specifications,valid_from,valid_to,in_stock,warranty,aw_product_id,merchant_image_url,description/format/csv/delimiter/,/compression/gzip/adultcontent/1/
I've cut out a large section in the middle, but it is just a long sequence of numbers separated by commas. In total the URL is 1939 characters long.
Copying the URL into a browser works fine - it is a download link and the file opens as it should.
The code for the button is simple:
Private Sub download_button_Click()
Dim feed_hyperlink As String
feed_hyperlink = *"http://data... "*
ActiveWorkbook.FollowHyperlink feed_hyperlink
End Sub
When I run the procedure, I get the following error:
Run-time error '5': Invalid procedure call or argument
Hyperlinking a cell restricts the destination URL to 255 characters. Is a character limit what's causing the issue here, or is there another problem?
Upvotes: 1
Views: 405
Reputation:
I think you're right. It's probably too long as the longest one I can use before getting the same error is 1033
characters;
Sub Main()
Dim h As String
h = String(1034, "a")
Debug.Print Len(h)
ActiveWorkbook.FollowHyperlink h
End Sub
Upvotes: 2