I'd always start out using ItemsCB as my template, it has a lot of
stuff that works around various Outlook bugs and problems that we've
discovered over the years. And it also shows the best practices ways
to do Outlook things.
So the problem comes down to the attachment is really being deleted
but visually doesn't show that? Outlook caches open items. I'd release
the open item and get a new copy of it, that should force a refresh of
what's shown.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
JoBless said:
DK is Denmark, Europe
I'm not using the ItemsCB, but the com add-in template.
Here is some of my code:
Private Sub objMailItem_AttachmentAdd(ByVal Attachment As
Outlook.Attachment)
Dim FSO As Scripting.FileSystemObject, strInputFile As String, strOutputFile
As String
Dim TempFolder As String
strInputFile = Attachment.FileName
strInputFile = "(temp)" & strInputFile
'Find tempfolder
Set FSO = CreateObject("Scripting.filesystemobject")
TempFolder = FSO.GetSpecialFolder(2)
If Right(TempFolder, 1) <> "\" Then TempFolder = TempFolder & "\"
'vis besked
Message.Label1.Caption = "Konverterer"
Message.Show
Message.Refresh
'Gem filen temporert
If FSO.FileExists(TempFolder & strInputFile) Then FSO.DeleteFile (TempFolder
& strInputFile)
Attachment.SaveAsFile TempFolder & strInputFile
........................................
Manuipulate the attached file
........................................
'vent yderligere 2 sec.
Call Sleep(2000)
'Omd¸b (fjern (temp) fra destinationsfilen)
FSO.CopyFile TempFolder & strOutputFile, TempFolder & Right(strOutputFile,
Len(strOutputFile) - 6), True
FSO.DeleteFile TempFolder & strOutputFile, True
strOutputFile = Right(strOutputFile, Len(strOutputFile) - 6)
'Tilf¸j ny attachment (konverteret)
objMailItem.Attachments.Add TempFolder & strOutputFile, , , strOutputFile
'Slet temporer fil
FSO.DeleteFile TempFolder & strOutputFile, True
'Slet attachment
Attachment.Delete
'clean-up
Set FSO = Nothing
'Skjul message
Unload Message
End Sub
Regarding the outlook2000 issue, i've discovered that the file is deleted as
supposed, it just seems that it isn't deleted. Is it possible to refresh the
outlook form (or anything else), so the file allso is removed visualy ??
Regards
JoBless