Hi, all:
I ran into some problems, I hope someone can help me solve this.
I'm currently developing an application, and a part of it will allow the users to open Outlook from the application and save the attachment of selected email to the HD.
After some work, I'm able to create the code which will automatically save the attachment of the first email item of the inbox (if it has an attachment), or I could loop through the whole inbox folder and do the same for all of the email items with attachments. But that is not what I wanted to achieve. What I want to do is to allow the user to only save the attachment of the email item that is selected in the inbox. And since it's random as to which email item will be selected, there's no way for me to determine the email item using the .items(index).
I was wondering if there's any method that's similar to a list box or combo box, such as .ItemIndex or ItemSelected and such, that will allow me to find out the index of the selected email item in the inbox.
here's some of the code I used:
Set lobjOutlook = CreateObject("Outlook.Application"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Set lobjFolder = lobjOutlook.activeexplorer.CurrentFolder
Set lobjItems = lobjFolder.items
Set lobjAttachments = lobjItems(1).attachments
lobjAttachments.Item(1).saveasfile "<path name>"
this will save the attachment of the first email item in the inbox. So I'm looking for something that might look like:
Set lobjAttachments = lobjItems(ItemSelected).attachments
please, if anyone can help me out in anyways, please give me some advices. Many thanks in advance.
Merlin
I ran into some problems, I hope someone can help me solve this.
I'm currently developing an application, and a part of it will allow the users to open Outlook from the application and save the attachment of selected email to the HD.
After some work, I'm able to create the code which will automatically save the attachment of the first email item of the inbox (if it has an attachment), or I could loop through the whole inbox folder and do the same for all of the email items with attachments. But that is not what I wanted to achieve. What I want to do is to allow the user to only save the attachment of the email item that is selected in the inbox. And since it's random as to which email item will be selected, there's no way for me to determine the email item using the .items(index).
I was wondering if there's any method that's similar to a list box or combo box, such as .ItemIndex or ItemSelected and such, that will allow me to find out the index of the selected email item in the inbox.
here's some of the code I used:
Set lobjOutlook = CreateObject("Outlook.Application"
Set lobjFolder = lobjOutlook.activeexplorer.CurrentFolder
Set lobjItems = lobjFolder.items
Set lobjAttachments = lobjItems(1).attachments
lobjAttachments.Item(1).saveasfile "<path name>"
this will save the attachment of the first email item in the inbox. So I'm looking for something that might look like:
Set lobjAttachments = lobjItems(ItemSelected).attachments
please, if anyone can help me out in anyways, please give me some advices. Many thanks in advance.
Merlin