Create/mail/delete - files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Henrik

    #1

    Create/mail/delete - files

    Can anyone help me??

    Im having trouble to delete and then create files, that i've emailed??.

    1)
    Im sending a file using cdo.message class

    Dim CDOMsg = New CDO.Message

    With CDOMsg
    .To = "me@my.com"
    .From = "me@my.com"
    .Subject = "FileTest"
    .HTMLBody = "<html>See attached file.</html>"
    .AddAttachment( "C:\test.tx t")
    .Send()
    End With

    2)
    Deleting the file
    If File.Exists(C:\ test.txt) Then
    File.Delete(C:\ test.txt)
    End If

    3)
    Then i tried to create a new file, with the same name. But i get a
    permission denied??


    I have found out that it's probely is the cdo.message, who still got a
    refferance to the file, but how do i remove this refferance to the cdo??

    Thanks
  • Rick Mogstad

    #2
    Re: Create/mail/delete - files

    CDOMsg = nothing


    "Henrik" <Henrik@discuss ions.microsoft. com> wrote in message
    news:64202543-FA73-40EE-830C-08E18F0DD046@mi crosoft.com...[color=blue]
    > Can anyone help me??
    >
    > Im having trouble to delete and then create files, that i've emailed??.
    >
    > 1)
    > Im sending a file using cdo.message class
    >
    > Dim CDOMsg = New CDO.Message
    >
    > With CDOMsg
    > .To = "me@my.com"
    > .From = "me@my.com"
    > .Subject = "FileTest"
    > .HTMLBody = "<html>See attached file.</html>"
    > .AddAttachment( "C:\test.tx t")
    > .Send()
    > End With
    >
    > 2)
    > Deleting the file
    > If File.Exists(C:\ test.txt) Then
    > File.Delete(C:\ test.txt)
    > End If
    >
    > 3)
    > Then i tried to create a new file, with the same name. But i get a
    > permission denied??
    >
    >
    > I have found out that it's probely is the cdo.message, who still got a
    > refferance to the file, but how do i remove this refferance to the cdo??
    >
    > Thanks[/color]


    Comment

    • Henrik

      #3
      Re: Create/mail/delete - files

      Hi Rick,,

      Sorry,, but of couse im setting my cdomsg to nothing, but it still does't
      work?

      Do you know if i can attach a stream insted?? then i can flush it instead..

      "Rick Mogstad" wrote:
      [color=blue]
      > CDOMsg = nothing
      >
      >
      > "Henrik" <Henrik@discuss ions.microsoft. com> wrote in message
      > news:64202543-FA73-40EE-830C-08E18F0DD046@mi crosoft.com...[color=green]
      > > Can anyone help me??
      > >
      > > Im having trouble to delete and then create files, that i've emailed??.
      > >
      > > 1)
      > > Im sending a file using cdo.message class
      > >
      > > Dim CDOMsg = New CDO.Message
      > >
      > > With CDOMsg
      > > .To = "me@my.com"
      > > .From = "me@my.com"
      > > .Subject = "FileTest"
      > > .HTMLBody = "<html>See attached file.</html>"
      > > .AddAttachment( "C:\test.tx t")
      > > .Send()
      > > End With
      > >
      > > 2)
      > > Deleting the file
      > > If File.Exists(C:\ test.txt) Then
      > > File.Delete(C:\ test.txt)
      > > End If
      > >
      > > 3)
      > > Then i tried to create a new file, with the same name. But i get a
      > > permission denied??
      > >
      > >
      > > I have found out that it's probely is the cdo.message, who still got a
      > > refferance to the file, but how do i remove this refferance to the cdo??
      > >
      > > Thanks[/color]
      >
      >
      >[/color]

      Comment

      Working...