J'arrive à envoyer des mesages depuis access mais l'option ".send" envoie directement le message.
Comment puis-je afficher la boite de dialogue outlook avant envoi pour voir le résultat de la programmation VBA
Version imprimable
J'arrive à envoyer des mesages depuis access mais l'option ".send" envoie directement le message.
Comment puis-je afficher la boite de dialogue outlook avant envoi pour voir le résultat de la programmation VBA
Salut,
J'ai trouvé ceci dans mes archives:
Dans un module tu places ce code:
Puis sur le bouton de ton formulaire tu places ceci:Code:
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78 Option Compare Database Option Explicit '************ Code Start ********** 'This code was originally written by Dev Ashish. 'It is not to be altered or distributed, 'except as part of an application. 'You are free to use it in any application, 'provided the copyright notice is left unchanged. ' 'Code Courtesy of 'Dev Ashish Private Declare Function apiShellExecute 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 '***App Window Constants*** Public Const WIN_NORMAL = 1 'Open Normal Public Const WIN_MAX = 2 'Open Maximized Public Const WIN_MIN = 3 'Open Minimized '***Error Codes*** Private Const ERROR_SUCCESS = 32& Private Const ERROR_NO_ASSOC = 31& Private Const ERROR_OUT_OF_MEM = 0& Private Const ERROR_FILE_NOT_FOUND = 2& Private Const ERROR_PATH_NOT_FOUND = 3& Private Const ERROR_BAD_FORMAT = 11& '***************Usage Examples*********************** 'Open a folder: ?fHandleFile("C:\TEMP\",WIN_NORMAL) 'Call Email app: ?fHandleFile("mailto:dash10@hotmail.com",WIN_NORMAL) 'Open URL: ?fHandleFile("http://home.att.net/~dashish", WIN_NORMAL) 'Handle Unknown extensions (call Open With Dialog): ' ?fHandleFile("C:\TEMP\TestThis",Win_Normal) 'Start Access instance: ' ?fHandleFile("I:\mdbs\CodeNStuff.mdb", Win_NORMAL) '**************************************************** Function fHandleFile(stFile As String, lShowHow As Long) Dim lRet As Long, varTaskID As Variant Dim stRet As String 'First try ShellExecute lRet = apiShellExecute(hWndAccessApp, vbNullString, _ stFile, vbNullString, vbNullString, lShowHow) If lRet > ERROR_SUCCESS Then stRet = vbNullString lRet = -1 Else Select Case lRet Case ERROR_NO_ASSOC: 'Try the OpenWith dialog varTaskID = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " _ & stFile, WIN_NORMAL) lRet = (varTaskID <> 0) Case ERROR_OUT_OF_MEM: stRet = "Error: Out of Memory/Resources. Couldn't Execute!" Case ERROR_FILE_NOT_FOUND: stRet = "Error: File not found. Couldn't Execute!" Case ERROR_PATH_NOT_FOUND: stRet = "Error: Path not found. Couldn't Execute!" Case ERROR_BAD_FORMAT: stRet = "Error: Bad File Format. Couldn't Execute!" Case Else: End Select End If fHandleFile = lRet & _ IIf(stRet = "", vbNullString, ", " & stRet) End Function '************ Code End **********
Espèrant que ceci t'aideras.Code:
1
2 Dim x x = fHandleFile("mailto:" & "AdresseMail", WIN_NORMAL)