|
|
Запуск Приложения (ShellExecute API)
#If VBA7 Then
Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hwnd As LongPtr, _
ByVal Operation As String, _
ByVal Filename As String, _
Optional ByVal Parameters As String, _
Optional ByVal Directory As String, _
Optional ByVal WindowStyle As Long = vbMinimizedFocus _
) As LongPtr
#Else
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hWnd As Long, _
ByVal Operation As String, _
ByVal Filename As String, _
Optional ByVal Parameters As String, _
Optional ByVal Directory As String, _
Optional ByVal WindowStyle As Long = vbMinimizedFocus _
) As Long
#End If
Примеры эксплуатации:
Private Sub ShellExecute_OpenFileInAssocApp()
Dim strPathOrURL As String
strPathOrURL = "d:\Temp\Перенос папки Users.pdf"
ShellExecute 0&, vbNullString, strPathOrURL, vbNullString, vbNullString, vbNormalFocus
End Sub
Private Sub ShellExecute_PrintFile(strFilePath As String)
ShellExecute 0&, "Print", strFilePath, 0&, 0&, vbHide
End Sub
|
|