Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default User form and send mail


Hi guys, I'm having some problems with Ron de Bruins send mail script o
a form command. I think I know where the problem is but I can’t fix it


What I’m looking for is

1 Command button clicked
2 Current form to be emailed
3 Form data to be cleared
4 Form to be saved and then closed

It’s number two which is causing the problems. I’m using the followin
code;


Code
-------------------
Private Sub cmdemail_Click()
If MsgBox("Please note this you only be sent at the end of the day. Are you sure you have finished for the day?", vbYesNo Or vbQuestion _
Or vbDefaultButton2) = vbYes Then
Unload Me
Call Mail_workbook_Outlook
End If
End Su
-------------------



Code
-------------------
Sub Mail_workbook_Outlook()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim wbname As String
Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook
wbname = "H:/" & wb1.Name & " " & _
Format(Now, "dd-mm-yy h-mm-ss") & ".xls"
wb1.SaveCopyAs wbname
Set wb2 = Workbooks.Open(wbname)
With wb2
.SendMail ", _
"todays work"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Su
-------------------


The program just hangs at the save temporary file part until you clic
on the close cross on the form so it looks like it will not save unles
the form is closed but my efforts with Unload Me or Unload (Formname
have been in vain.

Could anyone give me some pointers to where I have gone wrong?

-N

--
wizard535
-----------------------------------------------------------------------
wizard5353's Profile: http://www.excelforum.com/member.php...fo&userid=2369
View this thread: http://www.excelforum.com/showthread.php?threadid=47107

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default User form and send mail

Hi wizard5353

I test it and it is working for me.
You can send me your test workbook private then I test it for you.



--
Regards Ron de Bruin
http://www.rondebruin.nl


"wizard5353" wrote in message
...

Hi guys, I'm having some problems with Ron de Bruins send mail script on
a form command. I think I know where the problem is but I can't fix it.


What I'm looking for is

1 Command button clicked
2 Current form to be emailed
3 Form data to be cleared
4 Form to be saved and then closed

It's number two which is causing the problems. I'm using the following
code;


Code:
--------------------
Private Sub cmdemail_Click()
If MsgBox("Please note this you only be sent at the end of the day. Are you sure you have finished for the day?", vbYesNo Or
vbQuestion _
Or vbDefaultButton2) = vbYes Then
Unload Me
Call Mail_workbook_Outlook
End If
End Sub
--------------------



Code:
--------------------
Sub Mail_workbook_Outlook()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim wbname As String
Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook
wbname = "H:/" & wb1.Name & " " & _
Format(Now, "dd-mm-yy h-mm-ss") & ".xls"
wb1.SaveCopyAs wbname
Set wb2 = Workbooks.Open(wbname)
With wb2
.SendMail ", _
"todays work"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub
--------------------


The program just hangs at the save temporary file part until you click
on the close cross on the form so it looks like it will not save unless
the form is closed but my efforts with Unload Me or Unload (Formname)
have been in vain.

Could anyone give me some pointers to where I have gone wrong?

-NJ


--
wizard5353
------------------------------------------------------------------------
wizard5353's Profile: http://www.excelforum.com/member.php...o&userid=23692
View this thread: http://www.excelforum.com/showthread...hreadid=471070



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't send form as e-mail just_askin Excel Discussion (Misc queries) 3 July 8th 09 05:18 PM
Bypass: A program is trying to send mail using Item.Send prompt Vick Excel Discussion (Misc queries) 1 June 25th 09 03:31 AM
User Form to Mail Merge mully New Users to Excel 0 May 24th 05 11:45 AM
Send e-mail with CDO Luciano Excel Programming 0 January 12th 05 09:15 AM
Send FORM by mail Fede Querio Excel Programming 5 July 28th 03 10:50 PM


All times are GMT +1. The time now is 06:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"