By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,176 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

Need VBA coding for sending msgs using .OFT as body

P: 57
Hello evryone,

Happy Friday! I'm looking for a way to send mass emails using outlook email template (.oft) as body of the email since using information from the text box ruins the formatting.

Below is the code I'm working on.

Thank you.

Expand|Select|Wrap|Line Numbers
  1. Private Sub btn_send_Click()
  2.  
  3.     Dim olApp As Object
  4.     Dim objMail As Object
  5.     Dim Issue As String
  6.     strIssue = Me.txt_body
  7.  
  8.    On Error Resume Next 'Keep going if there is an error
  9.    Set olApp = GetObject(, "Outlook.Application") 'See if Outlook is open
  10.  
  11.    If Err Then 'Outlook is not open
  12.      Set olApp = CreateObject("Outlook.Application") 'Create a new instance
  13.    End If
  14.      'Create e-mail item
  15.      Set objMail = olApp.CreateItem(olMailItem)
  16.  
  17.   With objMail
  18.     .To = "XXXX@XXX.com"
  19.     .Subject = "Form issue"
  20.     .Body = strIssue & txt_sign
  21.     .send
  22.   End With
  23.  
  24.   MsgBox "Operation completed successfully"
  25.  
  26.  
  27. End Sub
I would prefer to click a button and upload a .oft template but a static location in the share drive is fine.

Thanks a lot for the help.
Feb 13 '15 #1
Share this Question
Share on Google+
1 Reply


P: 57
I would prefer to click a button and upload a .oft template but a static location in the share drive is fine.

Thanks a lot for the help.
Feb 13 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.