PDA

View Full Version : Outlook 2007 userform in template



Royzer
04-13-2012, 08:40 AM
Hi. I am really new to vba, and using forms controls and vba with Outlook, in particular.

I've created a single userform that has 3 check boxes in it. I just need those three boxes--not the entire userform window--to sit in the body of the email so the recipient can check the box that applies to their situation and reply to the email.

I'm using UserForm1.Show in the code that brings up the template I'd like to use, but it's just showing it in the box the three checkboxes were created in.
Here's the entire code I have. It's opening a template and inserting the current date, then I added the userform1.show command at the end. Please help me get the three checkboxes into the body of the email. Thanks! :hi:




Sub WIBWOverpaymentNotice()
Set newItem = Application.CreateItemFromTemplate("S:\AR and Recon\Overpayment templates\WIBW Overpayment Notice .oft")
newItem.Display
Set newItem = Nothing
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objItem As Object
Dim strStamp As String
On Error Resume Next
Set objOL = Application
Set objItem = objOL.ActiveInspector.CurrentItem
If Not objItem Is Nothing Then
If objItem.BodyFormat = olFormatHTML Then
Set objNS = objOL.Session
strStamp = Format(Now, "Long Date")
objItem.HTMLBody = Replace(objItem.HTMLBody, _
"datehere", _
strStamp)
End If
End If
Set objOL = Nothing
Set objNS = Nothing
Set objItem = Nothing


UserForm1.Show

End Sub