LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default opening outlook and populating

I have the following code which is started with a userform button.
It puts together the recipient string of email addresses, generates a random
subject line and message body, if the auto message is checked.
i now need to open out look, populate the sendto, subject and message body
with these things. Do i do this all in the same code? Should I build an email
function?
Any help would be appreciated.
My current code is below and is the code fro the userform button



Private Sub SendEmailBtn_Click()

Dim CBCtrl As MSForms.Control
Dim strReceipients As String
Dim MsgBody As String
'get the email addresses from the check boxes
For Each CBCtrl In RndmemailFrm.Controls
'If TypeOf CBCtrl Is MSForms.CheckBox Then
If TypeName(CBCtrl) = "CheckBox" Then
If CBCtrl.Object.Value = True Then
If InStr(CBCtrl.Caption, "@") 0 Then
strReceipients = strReceipients & ";" & CBCtrl.Caption
End If
End If
End If
strReceipients = Mid(strReceipients, 1)
Next
' generate the random subject line from the table in column 2
SubLine = Cells(Rnd * (Cells(Rows.Count, 2).End(xlUp).Row - 1) + 2, 2)
' if the Use Automated message is checked, then randomly select a message
from column 3
' or else use the message in the message text box
For Each CBCtrl In RndmemailFrm.Controls
If CBCtrl.Tag = "AutoMess" Then
If CBCtrl.Object.Value = True Then
MsgBody = Cells(Rnd * (Cells(Rows.Count, 3).End(xlUp).Row - 1) + 2, 3)
Else
MsgBody = RndmemailFrm.MsgBdyTB.Text
End If
End If
Next
End Sub


 
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
populating the recipient address in outlook thomas donino Excel Programming 6 August 21st 09 03:25 PM
populating a workbook but not opening it sam Excel Programming 1 July 16th 09 06:37 PM
populating table from outlook jake Excel Discussion (Misc queries) 0 March 23rd 06 10:53 AM
Vba - Opening Outlook with Vba ajliaks[_29_] Excel Programming 1 August 14th 04 05:52 PM
VBA for opening file/populating combo box with sheet names Sinobato[_4_] Excel Programming 3 July 26th 04 06:35 PM


All times are GMT +1. The time now is 08:00 PM.

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

About Us

"It's about Microsoft Excel"