WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

"A program has attachment filename open" Message returns

 
   Home -> Office -> Program Forms RSS
Next:  Default signature for a Group Mailbox  
Author Message
Venugopal

External


Since: Jun 16, 2009
Posts: 3



(Msg. 1) Posted: Tue Jun 16, 2009 8:12 am
Post subject: "A program has attachment filename open" Message returns
Archived from groups: microsoft>public>outlook>program_forms (more info?)

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
Back to top
Login to vote
Ken Slovak - [MVP - Outlo

External


Since: Oct 17, 2003
Posts: 2977



(Msg. 2) Posted: Tue Jun 16, 2009 1:53 pm
Post subject: Re: "A program has attachment filename open" Message returns [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Show the code you're using.

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

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Venugopal" <Venugopal.TakeThisOut@discussions.microsoft.com> 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
Back to top
Login to vote
Venugopal

External


Since: Jun 16, 2009
Posts: 3



(Msg. 3) Posted: Wed Jun 17, 2009 10:57 pm
Post subject: Re: "A program has attachment filename open" Message returns [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
Back to top
Login to vote
Ken Slovak - [MVP - Outlo

External


Since: Oct 17, 2003
Posts: 2977



(Msg. 4) Posted: Thu Jun 18, 2009 9:14 am
Post subject: Re: "A program has attachment filename open" Message returns [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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().

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Venugopal" <Venugopal DeleteThis @discussions.microsoft.com> 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
Back to top
Login to vote
Venugopal

External


Since: Jun 16, 2009
Posts: 3



(Msg. 5) Posted: Thu Jul 02, 2009 12:17 am
Post subject: Re: "A program has attachment filename open" Message returns [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

hi,

Thanks for reply.

GC.Collect() method was working.
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> Program Forms All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET |
  • IT Support