Commondialog - Open file

N

nc

Hi

I am using the macro below to save all attachments in an
form an email to a specified directory. I would also
like the macro to do one of the following as well,

1. Bring up up the Open file commondialogue with
the "Look in:" as directory above, and able to select one
or more files and click open button to open selected
files.

2. Open all the files in the directory

3. Open all the files in the email.

Help with coding all the above actions will be very much
appreciated.

Thanks.


Sub SaveInvReq()

Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector.CurrentItem
Set myAttachments = myItem.Attachments

For Each Itm In myAttachments
Itm.SaveAsFile "F:\Finance\Credit Control\Invoice
request\Invoice saved\" & _
Itm.DisplayName
Next Itm

End Sub
 
K

Ken Slovak - [MVP - Outlook]

With CommonDialog1
.DefaultExt = strDefaultExtension
.FileName = strDefaultFile
.ShowOpen
strResult = .FileName
End With

Set the default extension and default file name, strResult will have the
file to open.

To open the file you can use .ShowOpen. If you wanted to save the file you
would use the .ShowSave method.
 

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