Consulting

Results 1 to 3 of 3

Thread: open file from outlook

  1. #1
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    291
    Location

    open file from outlook

    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

  2. #2
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    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.
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  3. #3
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    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:[VBA]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[/VBA]
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •