Welcome to the TechSpot OpenBoards. Please read the FAQ if you have any questions. Login to participate.

Go Back   TechSpot OpenBoards > OS & Software > Misc. Software & Utilities

Problem Sending Email from Word

Reply
Bookmark / Share this page
Thread Tools
  #1  
Old 03-28-2007
Newcomer, in training
 
Member since: Mar 2007, 7 posts
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
Reply With Quote
  #2  
Old 03-28-2007
jobeard's Avatar
TechSpot Evangelist
 
Location: Southern Calif.
Member since: Apr 2005, 6,612 posts
you need to implement some debug code to verify that EACH object is not empty.
this will tell you where your code has failed.
Reply With Quote
You can remove this banner by registering, join the TS Community for free.
  #3  
Old 04-02-2007
Newcomer, in training
 
Member since: Mar 2007, 7 posts
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.
Reply With Quote
Reply
Thread Tools

Forum Jump

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.