楼主 kevinchengcw |
Q: 如何利用vba代码调用系统默认打开程序播放mp3文件? A: 示例代码如下:
声明: 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 原型: HINSTANCE ShellExecute( HWND hwnd, //父窗口句柄 LPCTSTR lpOperation, //操作,"open","print","explore" LPCTSTR lpFile, //文件名,前面可加路径 LPCTSTR lpParameters, //参数 LPCTSTR lpDirectory, //默认文件夹 INT nShowCmd //显示方式 ) 注:利用shellexecute可以实现很多文件利用默认打开程序打开的功能。 |
2楼 gysegz |
顶起,朋友** |