Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-11-2013, 03:02 PM
antipelagian antipelagian is offline Email submit that... Windows XP Email submit that... Office 2010 32bit
Novice
Email submit that...
 
Join Date: Feb 2013
Location: Ohio
Posts: 4
antipelagian is on a distinguished road
Default Email submit that...

What I'd like to do:
Find script/code for a command button that creates an email, attaches the active form but does NOT send the email. I'd like it to create the email, attach the file but pop up the email so the user can attach supporting documentation then manually send it.

Where I'm at:
I'm pretty new to making forms via Word...I'm used to making forms in LiveCycle Designer using javascript, so I'm kind of lost tweaking the code in Word. Here's what I have:



Code:
Dim OL As Object 
Dim EmailItem As Object 
Dim Doc As Document 
 
Application.ScreenUpdating = False 
Set OL = CreateObject("Outlook.Application") 
Set EmailItem = OL.CreateItem(olMailItem) 
Set Doc = ActiveDocument 
Doc.Save 
 
With EmailItem 
    .Subject = "Contract Initiation Form has been submitted" 
    .Body = "Please review the attached Form" 
    .To = "example@this.com" 
     
    .Cc = "example@this.com" 
    .Attachments.Add Doc.FullName 
    .Send 
End With 
 
Application.ScreenUpdating = True 
 
Set Doc = Nothing 
Set OL = Nothing 
Set EmailItem = Nothing 
 
End Sub
I'm trying to understand what each part of this code does...but for the life of me, I can't figure how to prevent the automated email submission. Do I tweak .Send? I tried deleting it that didn't help.

Bonus Points:
Can you create pop up warning windows via Word form? I'd like a pop-up that presents itself after the submit button is clicked reminding the user to attach additional documents...this is just for bonus brownie points

Last edited by macropod; 02-11-2013 at 04:39 PM. Reason: Added code tags & formatting
Reply With Quote
  #2  
Old 02-11-2013, 04:50 PM
macropod's Avatar
macropod macropod is offline Email submit that... Windows 7 64bit Email submit that... Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I don't use Outlook, so I can't say for sure, but you might get the results you're after by changing:
.Send
to:
.Display

Note that you can also programmatically add more attachments via additional '.Attachments.Add' lines.

PS: When posting code, please use the code tags. They're on the 'Go Advanced' tab.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-12-2013, 07:20 AM
antipelagian antipelagian is offline Email submit that... Windows XP Email submit that... Office 2010 32bit
Novice
Email submit that...
 
Join Date: Feb 2013
Location: Ohio
Posts: 4
antipelagian is on a distinguished road
Default Thanks...didn't work, however.

Quote:
Originally Posted by macropod View Post
I don't use Outlook, so I can't say for sure, but you might get the results you're after by changing:
.Send
to:
.Display

Note that you can also programmatically add more attachments via additional '.Attachments.Add' lines.
Thanks. When I use .Display, it prompts the Save As window and the VB debugger.

I'm not sure what you mean by using '.Attachments.Add' lines. I tried plunking the code into a new button and it didn't do anything.

Quote:
PS: When posting code, please use the code tags. They're on the 'Go Advanced' tab.
Will do. Thanks!
Reply With Quote
  #4  
Old 02-12-2013, 12:07 PM
antipelagian antipelagian is offline Email submit that... Windows XP Email submit that... Office 2010 32bit
Novice
Email submit that...
 
Join Date: Feb 2013
Location: Ohio
Posts: 4
antipelagian is on a distinguished road
Default Nevermind!

Figured it out...works great!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Email submit that... Outlook Email messsages do not show sender unless you open the email jdesnoue Outlook 5 04-22-2013 09:10 PM
Mail Merge to email, changing images on email layout ginelli Mail Merge 18 02-23-2013 09:47 AM
Email submit that... Outlook won't reply/forward email from one email address rluna68 Outlook 2 01-07-2013 12:42 PM
Can't create new email or access email acounts Outlook 2003 onthebeaches Outlook 1 02-20-2012 10:21 PM
How Many Email Addresses Can You email at one time in Outlook zinfandel72 Outlook 2 08-04-2008 06:39 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft