谁能告诉我下面的代码是怎么回事:
'Variables at top of module or some function/sub here
Private Declare 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 Long
'some function or sub routine here这段代码显示了函数declare的位置。我不熟悉declare关键字在做什么,也不理解为什么它不能编译。
当我通过vba在internet explorer中寻找打开标签的方法时,我得到了这个,但是我似乎不能让它工作。
似乎编译器没有将其识别为一个函数,但我已经看到一些论坛帖子使用了这段代码,但它没有任何问题(包括this one)。
似乎我可能遗漏了一个引用,或者可能是dll,但是我没有在“工具”菜单中看到这个库作为引用,我不知道如何检查我的机器上是否有这个库。
如果有人能给我指出正确的方向,那就太好了。
发布于 2012-08-21 04:42:30
API声明类似于常规的变量声明:它必须位于模块的顶部,在任何Subs/Functions之前。
https://stackoverflow.com/questions/12042458
复制相似问题