Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ms access Shell执行don';行不通_Ms Access_Vba - Fatal编程技术网

Ms access Shell执行don';行不通

Ms access Shell执行don';行不通,ms-access,vba,Ms Access,Vba,此代码: ShellExecute("C:\Program Files\Image Eye\ImageEye.exe","*.jpg", "*.png"); 不要工作。无法识别子shellexecute。为什么?您必须在模块顶部声明ShellExecute函数: #If VBA7 Then Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwn

此代码:

ShellExecute("C:\Program Files\Image Eye\ImageEye.exe","*.jpg", "*.png"); 

不要工作。无法识别子shellexecute。为什么?

您必须在模块顶部声明
ShellExecute
函数:

#If VBA7 Then
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 Long
#Else
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
#End If

您可以找到一个完整的示例…

我得到一个错误:项目代码需要更新才能在64位系统中使用。查看并更新说明,然后使用declare属性对其进行标记。如何更改?我已将答案编辑为与64位兼容。。。不同之处在于
PtrSafe
…请查看链接的示例,因为您对ShellExecute函数的调用缺少一个参数(nShowCmd)…谢谢,它可以工作。即使有另一个问题,我会打开另一个帖子,但是shellexecute现在可以工作了