Metti in un modulo questo:
, quindi per aprire un file usa ExecFile.codice:Option Explicit 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 Const SW_NORMAL = 1 Public Sub ExecFile(ByVal fileName As String) Dim ret As Long ret = ShellExecute(0, "open", fileName, vbNullString, vbNullString, SW_NORMAL) If ret<=32 Then Err.Raise 51, "ExecFile", "Impossibile eseguire il file """ & fileName & """." & vbCrLf & "Codice di errore di ShellExecute: " & LTrim(CStr(ret))+"." End If End Sub

Rispondi quotando