Solved

Word email VBA error message: "this item has been moved or deleted"

Posted on 2009-05-12
4
813 Views
Last Modified: 2012-05-06
I have a form that I created in Word with an e-mail (SendForReview) button on it. The email works fine, but several minutes after sending, Word opens and an error message pops up that says "this item has been moved or deleted". I click ok, and about a minute later the same thing happens. Then a minute later it happens again.

The code for the button is below, with the email addys removed...

Any ideas?
Private Sub CommandButton1_Click()
    ThisDocument.SendForReview _
        Recipients:="xxxx@xxx.com; xxxx@xxx.org", _
        Subject:="Please review this document.", _
        ShowMessage:=False, _
        IncludeAttachment:=True
End Sub

Open in new window

0
Comment
Question by:statler01
  • 3
4 Comments
 
LVL 13

Assisted Solution

by:game-master
game-master earned 200 total points
ID: 24371927


good afternoon!

try this approach!


sub SendEmail()
    Dim objMsg As Object
    Dim objConfi As Object
    Dim strBody As String
   
    Set objMsg = CreateObject("CDO.Message")
    Set objConfi = CreateObject("CDO.Configuration")
   
    With objMsg
        Set .configuration = objConfi
        .to = <receiver>
        .from = <sender>
        .Subject = "Test"
        .textbody = "This is a test message only."
        .AddAttachment <path of the file to attached>     ' example "C:\test.txt"
        .send
    End With
   
    MsgBox "OK"
end sub


i hope i could give u idea...

game-master
0
 
LVL 13

Assisted Solution

by:game-master
game-master earned 200 total points
ID: 24371934

this approach as well..

Set objSession = CreateObject("MAPI.session")
objSession.Logon profileName:="DARTS"

' Add a new message object to the OutBox.
Set objMessage = objSession.Outbox.Messages.Add

' Set the properties of the message object.
objMessage.Subject = "title"
objMessage.Text = "content"

' Add a recipient object to the objMessage.Recipients collection.
objMessage.Recipients.Add "alberto.viveros@gapac.com"
objMessage.Recipients(1).Type = RECIPTYPE_TO
objMessage.Recipients(1).Resolve

objMessage.Attachments.Add FileName, 0, 1, PathFile
objMessage.Update

objMessage.Send showDialog:=False
objSession.Logoff
0
 
LVL 9

Accepted Solution

by:
statler01 earned 0 total points
ID: 24379253
I found that the problem is that the "SendForReview" method tries to track the email. I had some problems relating to that.

I ended up with the following, which works fine:
Private Sub CommandButton1_Click()
    Dim bStarted As Boolean
    Dim oOutlookApp As Outlook.Application
    Dim oItem As Outlook.MailItem
    On Error Resume Next
        If Len(ActiveDocument.Path) = 0 Then 'Document has not been saved
            ActiveDocument.Save 'so save it
        End If
        'see if Outlook is running and if so turn your attention there
        Set oOutlookApp = GetObject(, "Outlook.Application")
            If Err <> 0 Then 'Outlook isn't running
                'So fire it up
                Set oOutlookApp = CreateObject("Outlook.Application")
                bStarted = True
            End If
        'Open a new e-mail message
        Set oItem = oOutlookApp.CreateItem(olMailItem)
        With oItem 'and add the detail to it
            .To = "abcde@wxyz.org; fghij@wxyz.org" 'send to this address
            .Subject = "Room Reservation" 'This is the message subject
            .Body = "Please review this reservation form." ' This is the message body text
            .Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue
            .Send
        End With
    Me.Close
End Sub

Open in new window

0
 
LVL 13

Expert Comment

by:game-master
ID: 24380628

good morning!

it's good to know that u make it work...


cheers..


game-master
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question