also @ TechSpot: Mozilla developing Metro-specific Firefox for Windows 8
Welcome to the TechSpot OpenBoards. Please read the FAQ if you have any questions. Sign up or Login to participate.

Go Back   TechSpot OpenBoards > Software > Software Apps

Download Now:

Problem Sending Email from Word

Thread Tools Search this Thread
  #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
  #2  
Old 03-28-2007
jobeard's Avatar
TechSpot Ambassador
 
Location: Southern Calif.
Member since: Apr 2005, 10,832 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.
  #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.
Closed Thread

Similar Topics
Topic Replies Forum
Yahoo email blocking Word attachment on one email only 0 Software Apps
How to Hide ip address for sending email 2 Software Apps
Outlook 2003 - problem sending email 5 Software Apps
Outlook account not sending external email 1 Software Apps
Sending animations by email 4 Software Apps

Thread Tools Search this Thread
Search this Thread:

Advanced Search
All times are GMT -4. The time now is 01:54 AM.