![]() |
#1
|
|||
|
|||
![]()
I am sure this has been asked before, but I can't seem to find a solution that is actually working. I am very new at VBA, so I apologize in advance.
I have a Word document with drop down lists, text boxes, and a command button. My ultimate goal is to allow my employees to fill out the drop down lists and text boxes, then have them click the command button and the information be sent to me in the body of an email. I need it to follow the same I have tried multiple times with information I found from Google, but nothing seems to be working. At this moment, I am using the following: Code:
Private Sub CommandButton1_Click() ActiveDocument.Content.Copy Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objInspector As Outlook.Inspector Dim objDoc As Word.Document Set objOutlook = CreateObject("Outlook.Application") Set objOutlookMsg = objOutlook.CreateItem(olMailItem) With objOutlookMsg .To = "recipient@domain.com" .Subject = "Report" .Body = ActiveDocument.Content .Send End With Set objInspector = objOutlook.ActiveInspector If Not objInspector Is Nothing And objInspector.EditorType = olEditorWord Then Set objDoc = objInspector.WordEditor objDoc.Range.Paste End If Set objDoc = Nothing Set objOutlookMsg = Nothing Set objInspector = Nothing Set objOutlook = Nothing End Sub The problem seems to be with the code: Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objInspector As Outlook.Inspector Dim objDoc As Word.Document As well as: .Body = ActiveDocument.Content I have unprotected the file and attached it here. Any help would be greatly appreciated! Last edited by macropod; 05-03-2016 at 06:17 PM. Reason: Added code tags |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Submit to Email Command Button | rob7676 | Word VBA | 0 | 08-20-2015 05:05 AM |
Help with a Command Button | dkohnken | Word VBA | 5 | 03-18-2015 10:13 PM |
![]() |
oduntan | Word VBA | 4 | 03-21-2013 02:15 PM |
![]() |
bigbird69 | Word VBA | 13 | 11-18-2012 10:06 PM |
![]() |
cksm4 | Word VBA | 7 | 02-27-2011 08:47 PM |