Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: attachment preview

Geek News

attachment preview
sophie 10/7/2008 8:37:01 AM
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.

Re: attachment preview
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 10/7/2008 12:59:01 PM
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.

--
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


"sophie" <sophie[ at ]discussions.microsoft.com> wrote in message
news:D5D3E644-F6F2-4A9E-B4C8-D476D8981047[ at ]microsoft.com...
[Quoted Text]
>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.
>

Re: attachment preview
sophie 10/8/2008 2:04:00 AM
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.

"Ken Slovak - [MVP - Outlook]" wrote:

[Quoted Text]
> 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.
>
> --
> 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
>
>
> "sophie" <sophie[ at ]discussions.microsoft.com> wrote in message
> news:D5D3E644-F6F2-4A9E-B4C8-D476D8981047[ at ]microsoft.com...
> >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.
> >
>
>
Re: attachment preview
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 10/8/2008 1:32:54 PM
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?

--
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


"sophie" <sophie[ at ]discussions.microsoft.com> wrote in message
news:86C32463-EF93-4E3D-87F5-23AA52713C46[ at ]microsoft.com...
[Quoted Text]
> 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.

Re: attachment preview
sophie 10/9/2008 8:33:02 AM

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.

"Ken Slovak - [MVP - Outlook]" wrote:

[Quoted Text]
> 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?
>
> --
> 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
>
>
> "sophie" <sophie[ at ]discussions.microsoft.com> wrote in message
> news:86C32463-EF93-4E3D-87F5-23AA52713C46[ at ]microsoft.com...
> > 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.
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net