+ Reply to Thread
Results 1 to 2 of 2

excel in the foreground

  1. #1
    Jono2000
    Guest

    excel in the foreground

    i need to call excel from outlook to open an attachment and saveas in a
    different format (csv as it happens).

    i'd much prefer it happened in the background. ie the email is received in
    outlook, and the functions are carried out without it taking over the pc.

    whats the easiest way to reference Excel and do this, or do i have to accept
    excel coming to the front and activating when my email is received?


  2. #2
    K Dales
    Guest

    RE: excel in the foreground

    You can keep the entire operation in Excel hidden from the user. In fact,
    when you create an automated Excel session it is by default invisible unless
    you make it visible. Here is the basic outline for running the Excel
    session, assuming you are using VBA from Outlook. Note first that you need
    to go to the VBA editor and add a reference to the Microsoft Excel Object
    Model:

    Dim xlApp as Excel.Application
    Dim xlBook as Excel.Workbook

    Set xlApp = New Excel.Application ' this starts up Excel in a hidden session
    ' xlApp will remain invisible unless you do xlApp.Visible = True
    Set xlBook = xlApp.Workbooks.Add ' Now you have created a workbook to use
    ' OR
    Set xlBook = xlApp.Workbooks.Open (FilePath) ' to open an existing file
    ' Do whatever processing you need to do here...
    xlBook.SaveAs FileName:="NewFilePath.csv" FileFormat:=xlCSV ' Saves as csv
    file
    xlBook.Close ' Closes the workbook
    xlApp.Quit ' Exits Excel

    Set xlBook = Nothing
    Set xlApp = Nothing ' Cleans up object variables



    --
    - K Dales


    "Jono2000" wrote:

    > i need to call excel from outlook to open an attachment and saveas in a
    > different format (csv as it happens).
    >
    > i'd much prefer it happened in the background. ie the email is received in
    > outlook, and the functions are carried out without it taking over the pc.
    >
    > whats the easiest way to reference Excel and do this, or do i have to accept
    > excel coming to the front and activating when my email is received?
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1