vba - 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)!
解决方案
基于 Ron deBruin 在他的页面上描述使用 Shell 解压缩的注释:
https://www.rondebruin.nl/win/s7/win001.htm
Shell 有时更喜欢变体而不是(例如)字符串,因此请尝试将其声明strURL
为Variant
String
推荐阅读
- android - Android 10 中带有 CollapsingToolbarLayout 的 Fragment 中的滚动和后退按钮不起作用
- html - 从设计中相对从容器中取出物品
- gmail-api - 在 django 400 错误中使用 google 进行社交登录
- javascript - 如何通过比较javascript中的检查值来获取对象/数组的索引
- java - 将数据从 Fragment 传递到 Fragment 但 bundle = null
- c# - 有没有办法只将当前属性值分配给另一个属性,以便以后更改值时它不会更新?UWP C#
- flutter - 如何在颤动中通用更改应用栏的字体系列?
- angular - 使用 Object.assign 打字稿键入安全类生成器
- c# - 将 PrivateObject 从 MSTest 转换为 XUnit
- redux - compose.apply(...) 不是函数