Home |
Search |
Today's Posts |
#13
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi....finally I managed to find what was wrong......In my own code, I
was trying clear the cells myself.....and then wondering why the fields are coming blank.... Me.txtcompno.Caption = "" Me.txtcustomer.Value = "" I removed above 2 lines from my code and now it works like dream! thanks ron for your patience and help! I am still looking for suggestions on the "Sender Name" problem. Cheers Vikram wrote: Hi Ron I just figured out that, this works if I create a separate commandbutton on the userform to send email. But as soon as I add this code to the additem code (shown below) it starts playing up. It opens email page fine, but the subject goes blank...and only shows default text. Is there any way, I could use a checkbox or something that will allow me to do both the things : 1. Add record to the database 2) send email with custom subject, with one commnd button instead of two? cheers ================================================== =========== Private Sub cmdAdd_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("ComplaintData") 'find first empty row in database iRow = ws.Cells(Rows.Count, 1) _ .End(xlUp).Offset(1, 0).Row 'copy the data to the database ws.Cells(iRow, 1).Value = Me.txtcompno.Caption ws.Cells(iRow, 2).Value = Me.txtdate.Caption ws.Cells(iRow, 3).Value = Me.txtcustomer.Value ws.Cells(iRow, 4).Value = Me.txtconper.Value ws.Cells(iRow, 5).Value = Me.txtproduct.Value ws.Cells(iRow, 6).Value = Me.txtbatch.Value ws.Cells(iRow, 7).Value = Me.txtcategory.Value ws.Cells(iRow, 8).Value = Me.txtdescription.Value ws.Cells(iRow, 9).Value = Me.txtAM.Value 'clear the data Me.txtcompno.Caption = "" Me.txtcustomer.Value = "" Me.txtconper.Value = "" Me.txtproduct.Value = "" Me.txtbatch.Value = "" Me.txtcategory.Value = "" Me.txtdescription.Value = "" Me.txtAM.Value = "" Dim OutApp As Object Dim OutMail As Object Dim strbody As String Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) With OutMail .To = " .CC = "" .BCC = "" .Subject = "A new Complaint No." & Me.txtcompno.Caption & " has been entered." .Body = "A new Complaint No." & Me.txtcompno.Caption & " has been entered for " & Me.txtcustomer.Value .display 'or use .Display End With Set OutMail = Nothing Set OutApp = Nothing Unload Me end sub ================================================== =========== |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Stop excel from dropping the 0 in the beginning of a number? | Setting up and Configuration of Excel | |||
Excel 2007 Custom Error Bars | Excel Discussion (Misc queries) | |||
Custom error bars excel 2007 | Charts and Charting in Excel | |||
Excel email address routing | Excel Discussion (Misc queries) | |||
Can you enable auto complete from a custom list in Excel? | Excel Discussion (Misc queries) |