"A program has attachment filename open" Message returns

Status
Not open for further replies.
V

Venugopal

hi,

I'm using Outlook 2007 addin with VS2008. I can able to add the attachments

to mailitem,but after that i have got the following message from outlook .

"A program has attachment <filename> open.Changes to this file will be lost

unless you save your changes to another file by clicking the Microsoft Office

Button in the other program, and then clicking Save As."

Note:

1.No such file (<filename>) opened when i got this message.

2.Also i checked with saving mailitem and saving attachments,but the same

message will appear.

3.I also checked when attachment file is not opened,but i face the same

problem

4.I surfed with this problem, i didn't get any solution

Help me as soon as possible
 
K

Ken Slovak - [MVP - Outlook]

Show the code you're using.

It's not intrinsic, I add attachments to items using code and never see that

message.

"Venugopal" <Venugopal> wrote in message

news:19723F10-4224-429F-9ED2-1B14852A8D8E@microsoft.com...
> hi,

> I'm using Outlook 2007 addin with VS2008. I can able to add the
> attachments
> to mailitem,but after that i have got the following message from outlook .

> "A program has attachment <filename> open.Changes to this file will be
> lost
> unless you save your changes to another file by clicking the Microsoft
> Office
> Button in the other program, and then clicking Save As."

> Note:
> 1.No such file (<filename>) opened when i got this message.
> 2.Also i checked with saving mailitem and saving attachments,but the same
> message will appear.
> 3.I also checked when attachment file is not opened,but i face the same
> problem
> 4.I surfed with this problem, i didn't get any solution

> Help me as soon as possible
 
V

Venugopal

hi

i used the below code.And called this function using button click event.

Issues:

1.First time the function runs successfully without any outlook message.

2.If i called that function at second time,then the above mentioned message

will appear.I have cheked with task manager but no such file was run at that

time.

[Outlook 2007 Addin + VS2008]

private void insertAttachments()

{

mail.Attachments.Add("filepath",

OlAttachmentType.olByValue,1,"filename");

mail.Display(true);

mail = null;

}

by,

Venugopal
 
K

Ken Slovak - [MVP - Outlook]

If that's all the code then I don't see why that message is appearing.

However, see if this makes any difference. Since Attachments.Add() is a

function get the returned Attachment object. Then when the procedure ends

release both the mail and attachment objects. Also explicitly declare and

instantiate the Attachments collection so no invisible object variables are

created.

Outlook.Attachments attachs = mail.Attachments;

Outlook.Attachment attach = attachs.Add("filepath",

OlAttachmentType.olByValue,1,"filename");

// blah, blah

attach = null;

attachs = null;

mail = null;

If that doesn't do it then call Marshal.ReleaseComObject() on all 3 objects

before setting them to null and then call GC.Collect().

"Venugopal" <Venugopal> wrote in message

news:D4552112-8782-41F7-B4AF-0553B87247F0@microsoft.com...
> hi

> i used the below code.And called this function using button click event.

> Issues:

> 1.First time the function runs successfully without any outlook message.

> 2.If i called that function at second time,then the above mentioned
> message
> will appear.I have cheked with task manager but no such file was run at
> that
> time.

> [Outlook 2007 Addin + VS2008]

> private void insertAttachments()
> {
> mail.Attachments.Add("filepath",
> OlAttachmentType.olByValue,1,"filename");
> mail.Display(true);
> mail = null;
> }

> by,
> Venugopal
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J it goes like outlook has stopped working, a problem caused the program to stop working correctly, wi Using Outlook 2
J My Outlook program has stopped receiving. I can still send Using Outlook 1
S Email Generated from another program and then edited sends original email. Using Outlook 2
J Program Checkbox that will activate a text box in a Outlook fallible form. Outlook VBA and Custom Forms 1
T Outlook "A program is trying to access Outlook" Using Outlook 3
Andrew Quirl Open attachment, manipulate without add-on program? Outlook VBA and Custom Forms 5
R SearchPublicFolders program Outlook VBA and Custom Forms 1
Diane Poremsky To Change the Default E-mail Program in Windows Using Outlook 0
I There is no email program associated to perform requested action Using Outlook 0
Diane Poremsky Trial/Beta program for BCM replacement BCM (Business Contact Manager) 8
C New version of MFCMAPI program Using Outlook 0
K A program is trying to send an e-mail message on your behalf... Using Outlook 1
A outlook 2007 - there is no email program associated ... Using Outlook 3
F Default Program for Opening .pst Files ? Using Outlook 6
A Outlook-Program Not Closing Properly Using Outlook 10
B How to remove an old program from the Tools dropdown? Using Outlook 7
D How to set permissions to allow external program to send an email? Using Outlook 0
T getting an error This file does not have a program associated with it for performing this action. C Using Outlook 7
N The add-in "C:\program files\google\google desktop search\googledesktopO..." could not be installed Using Outlook 32
R Access Program Only Looping Part Way Through Outlook Inbox Outlook VBA and Custom Forms 2
M Allow or Deny when a Program tries to send an email Outlook VBA and Custom Forms 1
R how to (re)set the default data file for Outlook in a VB program Outlook VBA and Custom Forms 2
J Program won't end in Win7 Outlook VBA and Custom Forms 1
D Outlook 2003 - A program is trying to access e-mail addresses Outlook VBA and Custom Forms 5
D Running a Program from Custom Action Rule Outlook VBA and Custom Forms 1
S Email Organizer Program Outlook VBA and Custom Forms 2
G GAL program acces in outlook 2007 Outlook VBA and Custom Forms 2
H Program "Click on Ribbon Button" Using VBA Outlook VBA and Custom Forms 1
H Program email save as text file Outlook VBA and Custom Forms 5
M Run external program from Outlook VBA macro Outlook VBA and Custom Forms 5
N How to attach a file with MS Outlook, from a program? Outlook VBA and Custom Forms 3
Q why this program doesn't work if Outlook is not manually launched? Outlook VBA and Custom Forms 4
V how to switchoff program access message in outlook 2003 Outlook VBA and Custom Forms 1
J Program Compatibility Issue - Outlook 2003 BCM BCM (Business Contact Manager) 4
O Comma Separated Values.ADR and A file error has occurred in the translator Using Outlook 5
D We're sorry but outlook has run into an error Using Outlook 6
A Prepending Email Addrs with "Display Name <email>" Has Stopped Working Using Outlook 0
N Outlook Has Become Sluggish Using Outlook 12
C Your mailbox has been temporarily moved ... Using Outlook 2
W Receiving mail for account that has been deleted Using Outlook 2
H Outlook 2003 find by "has attachment" Using Outlook 1
W Looks like the folder below has been deleted: "iCloud\Calendar" Using Outlook 1
oliv- determine to which address an email has been sent Outlook VBA and Custom Forms 3
A Using or not using apostrophes in search terms has this changed? Using Outlook 0
O Outlook 2016 has "Outlook 2015" files Using Outlook 2
M Outlook 2016 bottom reading pane has disappeared Using Outlook 2
G Download pdf attachments only if email subject has one of words Outlook VBA and Custom Forms 8
B Looking to filter (or just find/search) for only messages that the sender has sent more than 1 messa Using Outlook 2
M AVG has banjaxed Outlook. Using Outlook 1
B Wanting to run a script that will filter any body that has a russian link in it. Outlook VBA and Custom Forms 5

Similar threads

Top