Welcome to the TechSpot OpenBoards. Please read the FAQ if you have any questions. Login to participate.
Problem Sending Email from Word
|
|||||||
![]() |
| Thread Tools |
|
#1
|
|||
|
|||
|
Problem Sending Email from Word
OK, so here’s my problem.
I made up a request form in Word that has quite a few macros in it to automate the request process. My planned coup d’ grace was to have a macro commanded from the file menu to allow the submitter to kick out an E-mail, with the form attached, to the approver. The E-mail arrives in the approvers Inbox but when he double-clicks the Word icon the following popup appears: Microsoft Office Outlook “The operation failed. An object could not be found” And the Word document does not open. I also notice that the document size indicated is much smaller than it should be if the whole document was there. We are using MS Office Word 2003, Microsoft Office Outlook & Windows XP. The code I’m using for sending the form is below. Sub SendMailNew() Dim docWif As Word.Document Dim sProfile As String Dim objSession As Object Dim objMessage As Object Dim objRecipient As Object sProfile = "" Set docWif = ActiveDocument Set objSession = CreateObject("mapi.session") objSession.Logon profileName: = sProfile Set objMessage = objSession.Outbox.Messages.Add objMessage.Subject = "Submission" objMessage.Text = "A new request entitled :" & ActiveDocument.Bookmarks("Title").Range _ & ", has been submitted for consideration by " & ActiveDocument.Bookmarks("OrigSelect").Range objMessage.Attachments.Add docWif Set objRecipient = objMessage.Recipients.Add objRecipient.Name = "John Doe" objRecipient.Resolve objMessage.Send showDialog:=False MsgBox "Message is in your Outbox and will be sent shortly!" objSession.Logoff End Sub |
|
#2
|
||||
|
||||
|
you need to implement some debug code to verify that EACH object is not empty.
this will tell you where your code has failed. |
|
|
|
#3
|
|||
|
|||
|
Debug code
Can you direct me to a site or book(s) where I could learn about writing debug code. I've been unsuccessful searching for it with Google.
Thanks. |
![]() |
| Thread Tools | |
|
| Similar Topics | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Norton Internet Security 2005 preventing Outlook XP sending email | Chris N | Misc. Software & Utilities | 38 | 03-07-2008 10:29 PM |
| Microsoft works word processor to word format | Dave H | Misc. Software & Utilities | 4 | 10-18-2006 12:11 PM |
| ms word and text attachments? in email not attached? | Row1 | Misc. Software & Utilities | 1 | 10-05-2005 10:05 PM |
| Sending animations by email | Maurice | Misc. Software & Utilities | 4 | 03-18-2004 10:49 AM |
All times are GMT -4. The time now is 01:51 AM.



