|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Feb 2001
Città: Reggio Emilia
Messaggi: 230
|
EXCEL2004
Ho scritto del codice che utilizzo per aprire un file di Excel:"Cambi.xls" quando apro una maschera di Access.
Il mio problema è che se apro un'altro file di Excel (ad es. dalla cartella documenti) quando spengo il computer XP non riesce a chiudere Excel. Aprendo il Task Manager ho notato che nella lista dei processi Excel.exe compare 2 volte, perchè? In un modulo di Access2004: Option Compare Database Option Explicit Private 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 Const SW_SHOWNORMAL = 1 Dim path, fs, s, h Dim hwnd As Long Sub MyEXCEL() Set fs = CreateObject("Scripting.FileSystemObject") h = CurrentDb.Properties("name").Value s = fs.GetparentfolderName(h) path = s + "\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, SW_SHOWNORMAL Else Exit Sub End If End Sub In una maschera: Private Sub Form_Load() MyEXCEL End Sub |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 10:15.



















