Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart to foreground James Silverton[_3_] Excel Discussion (Misc queries) 1 April 1st 11 07:42 PM
Clicking on chart does not bring to foreground Eric Charts and Charting in Excel 1 August 9th 07 10:12 PM
background-foreground color Cenk Ursavas via OfficeKB.com Charts and Charting in Excel 3 May 26th 05 04:32 PM
VB6 Form in Foreground for Excel Rick[_13_] Excel Programming 2 October 14th 03 05:00 AM


All times are GMT +1. The time now is 05:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"