Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Kushal_Chawda

Macro does not work.. Help needed

Dear All,

I have macro which exports chart as image in outlook.It perfectly works but the problem is, it works when outlook is opened otherwise it treminates.

My need is when I click on button outlook should open with exported chars as image .

Please find the attached application.

5 Replies
marcus_sommer

I think the access on the outlook-library in "myApp.CreateItem(olMailItem)" failed. You could use an extra batch to open outlook before the mainpart runs.

Set oShell = WScript.CreateObject("WScript.Shell")

oShell.Run "C:\StartOutlookPerBatch.bat"

Content Batch:

cmd /C "C:\Program Files (x86)\Microsoft Office\Office14\OUTLOOK.EXE"

- Marcus

Kushal_Chawda
Author

Hi Marcus,

Thanks for the reply.

I am trying to achieve this as per your suggestion but it's not working. If it is working on your side then please send me that macro.

Regards

Kush

marcus_sommer

In my case it works, after a small change from:

Set oShell = WScript.CreateObject("WScript.Shell")

to

Set oShell = CreateObject("WScript.Shell")

Also check your office release, because the path to outlook is different:

2003:

cmd /C "C:\Programme\Microsoft Office\OFFICE11\OUTLOOK.EXE"

2010:

cmd /C "C:\Program Files (x86)\Microsoft Office\Office14\OUTLOOK.EXE"

- Marcus

Kushal_Chawda
Author

Hi Marcus,

Still it's not working. I have checked outlook path also. Everything is fine. Not getting what is issue.

Can you send me entire macro with application.

Regards,

Kushal

marcus_sommer

Hi Kushal,

here your changed app back. Works the batchfile standalone?

- Marcus