Chers amis,
Voici le code que j'utilise pour ouvrir mun fichier excel avec un clic sur bouton:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Dim objExcelApp
Dim FileName, AppName
Dim msg
Dim ExcelObj
Dim ExcelWb
Dim Found
 
	FileName = "D:\Mon ficher.xls"
	AppName = "Microsoft Excel"
 
	Set ExcelObj = CreateObject("Excel.Application")
 
	Set ExcelObj = GetObject(, "Excel.Application")
 
	On Error Goto 0
 
	For Each ExcelWb In ExcelObj.Workbooks
		'MsgBox excelwb.Name
		If ExcelWb.Name = "Mon ficher.xls" Then
			Found = True
			MsgBox "Mon ficher.xls already opened, switching to excel..."
			Exit For
		End If
	Next
 
	If Not found Then
		Set ExcelWb = ExcelObj.Workbooks.Open(FileName)
	End If
 
	ExcelObj.Visible = True
 
Exit Sub
Lorsque le fichier est déjà ouvert le message apparait, mais en cliquant sur ok du message, le fichier ne s'ouvre pas sur l'écran.
Il reste clignoté sur la barre de tâche.
Quelqu'un peut m'aider à résoudre se problème?