Reputation: 394
I ran into a weird VBA problem: having a string variable strURL
containing a valid URL
CreateObject("Shell.Application").Open strURL ' does *not* work
whereas
CreateObject("Shell.Application").Open strURL & vbNullString ' works
while "works" means opens browser with given URL as intended. Code resides in an unbound form module in Access (current Office 365 version).
Although I found my workaround, I'd really like to understand the reason why (and leave a hint to others that may run into the same problem)!
Upvotes: 0
Views: 1560
Reputation: 166511
Based on Ron deBruin's notes on his page describing use of Shell to unzip:
https://www.rondebruin.nl/win/s7/win001.htm
Shell sometimes prefers variants over (eg) strings, so try declaring strURL
as Variant
if you have it as String
Upvotes: 1