PDA

View Full Version : open file from outlook



philfer
09-11-2010, 03:07 PM
Hi,

As part of a process I am working on we receive a workbook by email (from a trusted source) that needs to be imported and worked on. Is there a way to use the OpenFileDialog box to allow the user to select it from Outlook as soon as it arrives (or the temporary location outlook holds the file - where is that by the way?) rather than having the user open it from outlook and save it before importing it from that location

Thanks
Phil

Simon Lloyd
09-11-2010, 04:08 PM
You can't have it open as it arrives as excel won't know ithas arrived, but you could open the dialogue box to this folder \Local Settings\Temporary Internet Files\OLKBD and the user can select which file to open.

Simon Lloyd
09-11-2010, 04:21 PM
Just checking but i don't think the files are available until you have opened (downloaded) them, but here's a code to open to a specific folder:Sub Get_Data()
ChDrive "C:\" 'change drive to suit
ChDir "C:\Documents and Settings\user\Local Settings\Temporary Internet Files\OLKBD" 'Change path to suit
FileToOpen = Application.GetOpenFilename _
(Title:="Please choose a file to Open", _
FileFilter:="Excel Files *.xls (*.xls),")
''
If FileToOpen = False Then
MsgBox "No file specified.", vbExclamation, "No Selection"
Exit Sub
Else
Workbooks.Open Filename:=FileToOpen
End If
End Sub