PDA

View Full Version : Read and Write from an attachment in Outlook



DarylPeeters
11-05-2008, 06:08 AM
Dear all,

We receive several excel documents with a standard layout from customers here in the office. Now i'm getting the hang of the macro's :beerchug:

What I want to do is that if the user gets the mail or the attachment item in the specific folder I need to get the file processed.

For the processing I need to read the document and write text as being a csv to a specific locaation.

The only little push i need is to know how to read from the excel document within outlook, the other subroutine is already done.

I found a subroutine to save the attachment and use it as an connection to excel, but i rather not choose this, but to stay in outlook.

I'm not allowed to post links (my post score is < 5), then other. if you type h t t p : / / w w w before the follwing 'link' you see my search result: vbaexpress.com/forum/showthread.php?t=22722&highlight=read+excel

Anyone with some advise?

Best regards,
Daryl Peeters

JP2112
11-05-2008, 11:42 AM
Hi Daryl,

If you want to read worksheet data from another object model, all you need to do is create a reference to the Excel.Application object. Then you can work with the worksheet properties using the same code you would use if you were in Excel. The only difference would be that for some properies you would need to fully qualify the application object reference. For example



' declare object and reference Excel
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")

' open a workbook, etc
xlApp.DisplayAlerts = False
xlApp.Workbooks.Open ("C:\MyBook.xls")
'etc



HTH,
JP


Dear all,

We receive several excel documents with a standard layout from customers here in the office. Now i'm getting the hang of the macro's :beerchug:

What I want to do is that if the user gets the mail or the attachment item in the specific folder I need to get the file processed.

For the processing I need to read the document and write text as being a csv to a specific locaation.

The only little push i need is to know how to read from the excel document within outlook, the other subroutine is already done.

I found a subroutine to save the attachment and use it as an connection to excel, but i rather not choose this, but to stay in outlook.

I'm not allowed to post links (my post score is < 5), then other. if you type h t t p : / / w w w before the follwing 'link' you see my search result: vbaexpress.com/forum/showthread.php?t=22722&highlight=read+excel

Anyone with some advise?

Best regards,
Daryl Peeters

DarylPeeters
11-05-2008, 11:48 AM
OK Cool,
Thanks for the advise !

DarylPeeters
01-17-2009, 05:52 AM
Just wanted to reply that the program works as hell ! :devil2:
thanks !

JP2112
01-17-2009, 06:51 AM
Glad to hear it!

--JP


Just wanted to reply that the program works as hell ! :devil2:
thanks !