Reputation: 2772
On my vba procedure, I have ActiveWorkbook.FollowHyperlink Address:=link
but "Link" is often too big for the function to use because "link" could hold string values as big as a small paragraph and this causes me to have a run-time error. It works with links with smaller string size but the with the big ones, if fails with this exact error below
Is there another way to open links using vba that could handle big urls?
Upvotes: 0
Views: 567
Reputation: 42236
Please, try using API. It should accept the URL maximum string length (2048).
Option Explicit
Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
Sub testOpenURL
ShellExecute 0&, vbNullString, "http://www.your big string representing URL", vbNullString, vbNullString, 5
End Sub
Upvotes: 1