Can i open an excel file and print it automaticaly from outlook

S

Stew J

I would like to make excel print a sheet on a weekly basis. the sheet is
part of an accounting file and the results are updated daily. I need the
information to be either printed or saved to my desktop for manual printing
later. This needs to be completed every Monday.
 
J

Joel

This is a question for the programming group in outlook. Below is a macro
that will run from outlook macro (not excel). I don't know how to have
outlook schedule the task (macro) to run weekly.


Sub openexcel()
'Dim wb As excel.workbook

FName = "C:\temp\book1.xls"
Set xlApp = Application.CreateObject("Excel.Application")
Set xlbook = xlApp.Workbooks.Open(FName)
xlbook.PrintOut

End Sub
 
S

Stew J

Hi Joel, Thats great thanks, just one more questions at the moment, - if I
wanted to only print 1 sheet of 3 within the book, is there a way to do that?

Thanks
Stew
 
J

Joel

from
xlbook.PrintOut
to
xlbook.sheets("Sheet1").PrintOut
or
xlbook.sheets(1).PrintOut

It took me a while to get the right syntax for the OBJECT line. Microsoft
has two different syntax for Macros. the one for excel and the one for other
office products. Try going to help in Outlook but couldn't find the correct
help. finally I went to word and looked up object. found the correct syntax
and it also worked in Outlook.

for microsoft Office
Set xlApp = Application.CreateObject("Excel.Application")
for excel
Set xl = CreateObject("Excel.Sheet")
 
S

Stew J

Works a treat.

Many thanks
Stew

Joel said:
from
xlbook.PrintOut
to
xlbook.sheets("Sheet1").PrintOut
or
xlbook.sheets(1).PrintOut

It took me a while to get the right syntax for the OBJECT line. Microsoft
has two different syntax for Macros. the one for excel and the one for other
office products. Try going to help in Outlook but couldn't find the correct
help. finally I went to word and looked up object. found the correct syntax
and it also worked in Outlook.

for microsoft Office
Set xlApp = Application.CreateObject("Excel.Application")
for excel
Set xl = CreateObject("Excel.Sheet")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top