• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 852
  • Last Modified:

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

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
statler01
Asked:
statler01
  • 3
3 Solutions
 
game-masterCommented:


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
 
game-masterCommented:

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
 
statler01Author Commented:
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
 
game-masterCommented:

good morning!

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


cheers..


game-master
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now