VB 关闭程序时自动运行某文件的语句

来源:百度知道 编辑:UC知道 时间:2024/07/06 17:20:23
我想在关闭程序时,提示是否要打开某固定位置的excel文件,是打开,否离开。
这个语句什么写啊?

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

private sub form_unload(cancel as integer)
dim x
x = msgbox("是否打开excel文件?",vbyesno)
if x = vbyes then
ShellExecute me.hwnd,"open","c:\1.xls","","",5)
end if
end sub