View Single Post
  #4  
Old October 3rd 06, 07:45 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Call macro stored in Excel workbook from Outlook's macro

Am Mon, 2 Oct 2006 09:56:02 -0700 schrieb Gvaram:

Please read the VBA help for the Application.Run function, thereīs also a
sample. As I understand it, you donīt need to open the workbook, but need
the Excel Application object.

Calling Outook VBA methods from outside isnīt documented, i.e. it works for
the time being but you canīt rely on that. And thereīs no reason that it
must work for any other application, too.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


I tried "Run" but there is the same result.
I don't know exactly, but I think the problem is in the way I'm connecting
to the excel file. I tried:
1. GetObject("C:\Test.xls")
2. Excel.Application.Workbooks.Open("C:\Test.xls")

I don't know is there any other way to open excel file and call function
stored there? Logically, if excel macro can call outlook macros, Outlook
should do the same also - both of them are microsoft products and use VBA.
But how???

Pleeease help....

"Michael Bauer [MVP - Outlook]" wrote:

Am Sun, 1 Oct 2006 14:16:01 -0700 schrieb Gvaram:

The Excel Application object knows a Run method. Probably that helps.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


I'd like to run macro function "ExcelTestMacro" stored in "C:\Test.xls"
(which is already open), when the new mail massage comes.

I can call macro in Outlook from Excel easily for example by :
Call ",

"Test","C:\test.xls")

But I could not call Excel macro from Outlook that way.
I allowed access to Visual basic Project and tried:
Set MyExBook = Excel.Application.Workbooks.open("C:\Test.xls")
call MyExBook.ExcelTestMacro
but there appears Run-Time error 'Object does not support this property

or
method'. Of course I'm doing something wrong...

Somebody please help and tell me what to do


Ads