G
Guest
Outlook Experts,
Each morning I receive 14 emails, each of which contains an attachment.
The attachment are somehow encoded, and when I click on the attachment a
dialog box comes up, I enter a password, and the attachment opens. The
attachment opens as a .html file. I then save the attachment as a .txt file.
Later I open the attachment again and change the encoding to ANSI.
I'm attempting to write a macro that will go through the 14 e-mails, open
each attachment, enter the password in a dialog box, and then save each
attachment to a directory with a sequential generic name such as File1,
File2, etc.
This is my code so far:
Sub OpenAttachment()
Dim objApp As Outlook.Application
Dim objAtt As Outlook.Attachment
Set objApp = CreateObject("Outlook.Application")
Set objFolder = objApp.ActiveExplorer.CurrentFolder
For Each objItem In objFolder.Items
objItem.Attachments(1).View
Next objItem
End Sub
I've gotten stopped when I try to open the attachment. On the attachment, I
can't use a FileSaveAs method, because, until I enter the password, there is
nothing to save.
I believe I'm missing the correct method on the line:
objItem.Attachments(1).View
What method would I use so that the attachment is opened?, and
can I enter the password in the dialog box that comes up?
Thanks in advance,
Alan
Each morning I receive 14 emails, each of which contains an attachment.
The attachment are somehow encoded, and when I click on the attachment a
dialog box comes up, I enter a password, and the attachment opens. The
attachment opens as a .html file. I then save the attachment as a .txt file.
Later I open the attachment again and change the encoding to ANSI.
I'm attempting to write a macro that will go through the 14 e-mails, open
each attachment, enter the password in a dialog box, and then save each
attachment to a directory with a sequential generic name such as File1,
File2, etc.
This is my code so far:
Sub OpenAttachment()
Dim objApp As Outlook.Application
Dim objAtt As Outlook.Attachment
Set objApp = CreateObject("Outlook.Application")
Set objFolder = objApp.ActiveExplorer.CurrentFolder
For Each objItem In objFolder.Items
objItem.Attachments(1).View
Next objItem
End Sub
I've gotten stopped when I try to open the attachment. On the attachment, I
can't use a FileSaveAs method, because, until I enter the password, there is
nothing to save.
I believe I'm missing the correct method on the line:
objItem.Attachments(1).View
What method would I use so that the attachment is opened?, and
can I enter the password in the dialog box that comes up?
Thanks in advance,
Alan