This will send To, CC and BC as well as Subject, Message, and Attachment<br>You need 6 text boxes or variables which match the following:<br>txtMainAddresses<br>txtCC<br>txtBCC<br>txtSubject<br>txtBody<br>txtAttachment<br><br>Put this in your Module<br>------------------------------<br>Public 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<br>------------------------------<br>put this in a command button<br>------------------------------<br>Private Sub Command0_Click()<br>On Error GoTo Err_Command0_Click<br><br> Dim stext As String<br> Dim sAddedtext As String<br> If Len(txtMainAddresses) Then<br> stext = txtMainAddresses<br> End If<br> If Len(txtCC) Then<br> sAddedtext = sAddedtext & "&CC=" & txtCC<br> End If<br> If Len(txtBCC) Then<br> sAddedtext = sAddedtext & "&BCC=" & txtBCC<br> End If<br> If Len(txtSubject) Then<br> sAddedtext = sAddedtext & "&Subject=" & txtSubject<br> End If<br> If Len(txtBody) Then<br> sAddedtext = sAddedtext & "&Body=" & txtBody<br> End If<br> If Len(txtAttachment) Then<br> sAddedtext = sAddedtext & "Attach=" & Chr$(34) & Me!txtAttachment & Chr$(34)<br> End If<br> <br> stext = "mailto:" & stext<br> <br> If Len(sAddedtext) <> 0 Then<br> Mid$(sAddedtext, 1, 1) = "?"<br> End If<br> <br> stext = stext & sAddedtext<br> <br> ' launch default e-mail program<br> If Len(stext) Then<br> Call ShellExecute(Me.hwnd, "open", stext, vbNullString, vbNullString, SW_SHOWNORMAL)<br> End If<br><br>Exit_Command0_Click:<br> Exit Sub<br><br>Err_Command0_Click:<br> MsgBox Err.Description<br> Resume Exit_Command0_Click<br> <br>End Sub<br><br>------------------------------<br><br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
DougP<br><br>Thanks for this!<br>I can't find any info on the ShellExecute command. I can't get this to work as it is asking me to define the "SW_SHOWNORMAL"<br><br>Can you please explain the difference between shell and shellexecute?<br><br>Also what does SW_SHOWNORMAL and how can I define it?<br><br>Thanks.<br>Davo
Shell Execute a is function in the Shell32.dll<br>Look in your Windows\system folder for that file "Shell32.dll". The difference is its an API call which can be called by any program like VB or C++<br>Shell is a function in VB and Access that is a stripped down version of ShellExecute.<br><br>If Shell32.dll is not there, then are you running Windows '95 not OSR-2?<br>I suspect that the reason SW_SHOWNORMAL is not available is because of a very early version of Windows too.<br>I am using Windows 2000 Professional. I know this also works in NT 4.0<br>I substituted a 1 for SW_SHOWNORMAL and it worked. <br>I just re-tested it right now to make sure it works and it does.<br>Now did you put the following in a module?<br><br>Public 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<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
DougP<br><br>Thanks. <br>Its works (ie calls the functions inside the shell.dll) my only problem now is that I have no Microsoft email software (lotus Notes v4.6 on NT4 with Access97). <br><br>lotus Notes v4.6 is MAPI compatiable.<br><br>My problem now is an error mesage <br>(title)Problem with short cut<br>(body)Cannot send mail. No program is setup to send mail using internet shortcuts.<br><br>Any suggestions?<br>Thanks<br>Davo<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.