首页 > 解决方案 > VBA CreateObject("Shell.Application").Open strURL does not work

问题描述

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)!

标签: vbams-access

解决方案


基于 Ron deBruin 在他的页面上描述使用 Shell 解压缩的注释:

https://www.rondebruin.nl/win/s7/win001.htm

Shell 有时更喜欢变体而不是(例如)字符串,因此请尝试将其声明strURLVariantString


推荐阅读