Open and run Outlook from Excel automatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to open outlook from excel with Inbox as the default folder and
use the Task to fire a reminder. In the remainder event of outlook I am
opening an excel sheet selecting some cells and sending out an email.
I am not sure if this is the best way to do it, but since I have to install
it on a corporate server, it has to fire up and send email every day I found
out that this way works with out having to install anything new.
Now, the problem is the code inside the remainder event in outlook fires and
works if the outlook is opened manually. If the outlook is opened by excel
this event does not fire.
Please advice on what might be a cause and if this is the best way of doing
what I explained above.
Thanks.
 
The Reminder event is most likely not firing in your Excel macro because you
haven't declared an Outlook.Application object using the With Events keyword,
which allows access to the Application.Reminder event. This event is
automatically wired up for you in the ThisOutlookSession module in the
Outlook VBA Editor, so you should probably move your reminder and Excel
handling code there.
 
Thanks for you reply. I should have mentioned it earlier, I already put the
excel logic in to Application.Reminder event in ThisOutlookSession. The
problem comes up when i am opening outlook from excel. The event does not
fire when outlook is opened from excel. Should I be declaring Outlook object
in excel with the with events key word? I am not declaring any events in
excel.

Thanks!!
 
The purpose of this program is to run on a corporate server each morning
where I have limited/restricted access. I have a macro which parses data and
creates a excel spreadsheet of the results. I am getting that macro to open
outlook which inturn mails out the results.
Since i am not continuously logged into that server nor am I the only user
of the server, I am using excel to automatically open outlook each morning. I
am not sure if this is the right way ... Guide me if there is some thing else
I should be doing.

I tried creating emails from excel and got a security message which I cannot
supress from the program. I tried CDO and still got the security message
asking for confirmation to send email which I could not supress.

Thanks again.
 
Thanks for your reply. I though that outlook cannot be run by a windows
service directly and used the excel thing to open outlook. Now that I know
that it doesnt work that way... can you pls point me in the right
direction...How this should be done?

Thanks Again !!
 
I'd set a reference to the Microsoft Office Excel Object Library in your
Outlook VBA Editor and move all the Excel macros there. You'll only have to
change the parts of your code that deal with creating or opening a workbook,
as those objects are referenced automatically inside Excel, but not Outlook.

You could also keep your macros in Excel, but automate running it from
Outlook:

Sub RunExcelMacro()

Dim objExcel As Object

Set objExcel = New Excel.Application

objExcel.Workbooks.Open "C:\Documents and
Settings\elegault\Desktop\Book1.xls"
objExcel.Run "Macro1"
objExcel.Workbooks.Close
objExcel.Quit
Set objExcel = Nothing
End Sub

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
 
Back
Top