attachment preview

S

sophie

I am working on an attachment problem. If there are some attachments in
email, then pop up a window before i send it. Then i can check the
attachments list. and preview the text by double click the name of the
attachment.

if I modify the attachment, in fact it modified a temp file. Then i try to
delete the original attachment and add the temp file as attachment again, so
that the modified attachment can be sent.

but, i have a problem. when i debugging the project, it works all right. The
attachment which have been modified has been sent. If i check it for two
times, that is double click the attachment for two times and preview it for
two times, then it works all right, the modified one is sent. but, if i click
the attachment for one time, then modify it, save it, and send the email, the
modified one is not sent.

i don't know why.

Any help will be appreciated.
 
K

Ken Slovak - [MVP - Outlook]

There's no way to tell what's going on from that information. You will need
to show some of the code that you're using to do that, just the relevant
parts.
 
S

sophie

Thanks Ken.

The code in double click attachment name:
Private Sub listFileName_DblClick()
Dim fileIndex As Long
fileIndex = Me.ListFileName.SelectedItem.index
Dim objTemp As Outlook.MailItem
Set objTemp = objMailItem

selfile = strTempDir & "\" & Me.ListFileName.SelectedItem.Text
lResult = ShellExecute(0, "Open", selfile, vbNull, vbNull, 1)

objTemp.Attachments.Remove (fileIndex)
objTemp.Attachments.Add (selfile)
Set objMailItem = objTemp
End Sub

Private Sub ListFileNmae_ItemCheck(ByVal Item As MSComctlLib.ListItem)
Dim bOkEnabled As Boolean
Dim objItem as MSConctlLib.listItem
bOkEnabled = true
For Each objItem In Me.ListFileName.ListItems
bOkEnabled =bOkEnabled and objItem.Checked
Next objItem
me.Okbutton.Enabled =bOkEnabled
End Sub

Private sub Okbutton_click()
Dim objTemp as Outlook.MailItem
set objTem =objMailItem

If Not (objTemp Is Nothing) Then
bConfirmed = true
objTemp.send
bConfirmed =false
objTemp.Close
set objTemp= nothing
End If
End sub

there are a list of attachment. After i have check them, it will be sent.
 
K

Ken Slovak - [MVP - Outlook]

The code doesn't show it but I assume that objMailItem is set previous to
any of those methods or event handlers being called?

I don't see where you're saving the item after modifying it by
removing/adding attachments, have you tried that?
 
S

sophie

Thanks, Ken.

I have resolve this problem in another way.

I found that if i remove or add the attachment when user check the
attachment list, it will be much easy. And it works all right.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top