Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I am creating a spreadsheet that is sent out to individuals, they fill in details and then using a "submit" button, return it to me. I am using code I got from Ron DeBruin's site but unfortunately I cannot get it to work. Excel gets to the point of sending the email and then just freezes. When I run this from VBA explorer it works ok and the dialog box saying Excel is trying to send an email appears and the email is sent when I press yes. The problem is that it won't work if VBA is not open. Any ideas? The send code is below. 'Save the new workbook/Mail it/Delete it 'TempFilePath = Environ$("temp") & "\" TempFilePath = Dir 'TempFileName = "Part of " & Sourcewb.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss") TempFileName = Filename & " Returned" & ".xls" MsgBox "Your form is being returned" With Destwb .SaveAs TempFilePath & TempFileName, FileFormat:=FileFormatNum MsgBox "Saved Temp File" On Error Resume Next MsgBox "About to send" .SendMail ", _ TempFileName 'On Error GoTo 0 MsgBox "Sent" .Close SaveChanges:=False End With 'Delete the file you have send Kill TempFilePath & TempFileName With Application .ScreenUpdating = True .EnableEvents = True End With End Sub Alternative code that I have used in the past is a s follows: Dim Mail As String Let Mail = " ' Application.Dialogs(xlDialogSendMail).Show arg1:=Mail This works but the sendmail option seemed slightly more elegant (and also removed most opportunities for users to mess up the process. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
sendmail macro problem in Excel | Setting up and Configuration of Excel | |||
Need Help with SendMail | Excel Programming | |||
SendMail | Excel Programming | |||
Sendmail | Excel Programming | |||
Sendmail: Problem when used after a Userform | Excel Programming |