Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Chart to foreground | Excel Discussion (Misc queries) | |||
Clicking on chart does not bring to foreground | Charts and Charting in Excel | |||
background-foreground color | Charts and Charting in Excel | |||
VB6 Form in Foreground for Excel | Excel Programming |