CIUFFO
06-01-2003, 01:04
Perchè in XP Find Windows non funzia?
Questo codice sotto 98 funziona correttamentePrivate Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
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
Sub excel()
Dim path
Dim hwnd As Long
path = (directory di CAMBI.xls)
hwnd = FindWindow(vbNullString, "Microsoft Excel - CAMBI.xls")
If hwnd = 0 Then ' 0 significa che il file di Excel non è in esecuzione.
ShellExecute hwnd, vbNullString, path, vbNullString, vbNullString, 0
Else
Exit Sub
End If
End Sub
Questo codice sotto 98 funziona correttamentePrivate Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
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
Sub excel()
Dim path
Dim hwnd As Long
path = (directory di CAMBI.xls)
hwnd = FindWindow(vbNullString, "Microsoft Excel - CAMBI.xls")
If hwnd = 0 Then ' 0 significa che il file di Excel non è in esecuzione.
ShellExecute hwnd, vbNullString, path, vbNullString, vbNullString, 0
Else
Exit Sub
End If
End Sub