Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default run macro from onoter Excel session

Hi,
I am tring to run a macro from another open workbook on another excel session.
I have tried using
Application.Run (PathToFile & "\" & NameOfFile & "!MacroName")
but the it open a new wotkbook (read only) and also get stuck.

Any idea,
Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default run macro from onoter Excel session

Hello Dan,

We need to get the corresponding Application COM object of that Excel
session and then call Application.Run() method.

To get that Excel session's Application object, we can call the
Marshal.BindToMoniker to get that workbook and then get the application
from the Workbook.Application.

http://msdn.microsoft.com/en-us/libr...services.marsh
al.bindtomoniker.aspx
http://www.xldennis.com/dloads/Acces...of%20Excel%20V
B.txt
(Process_Approach_BindToMoniker part)

If you have any future questions or concerns, please let us know!


Best regards,
Ji Zhou
Microsoft Community Online Support Team

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default run macro from onoter Excel session

I think the OP is working in Excel, not .NET

Tim

"Colbert Zhou [MSFT]" wrote in message
...
Hello Dan,

We need to get the corresponding Application COM object of that Excel
session and then call Application.Run() method.

To get that Excel session's Application object, we can call the
Marshal.BindToMoniker to get that workbook and then get the application
from the Workbook.Application.

http://msdn.microsoft.com/en-us/libr...services.marsh
al.bindtomoniker.aspx
http://www.xldennis.com/dloads/Acces...of%20Excel%20V
B.txt
(Process_Approach_BindToMoniker part)

If you have any future questions or concerns, please let us know!


Best regards,
Ji Zhou
Microsoft Community Online Support Team



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default run macro from onoter Excel session

Ok. Thanks Tim for the comments.

Dan,

In Excel native VBA, we can get another Excel session's Workbook object by
calling GetObject(pathname). Please refer to another post with the same
title you post. Peter gives an example code there.

If you need any future help on this, just let us know.


Best regards,
Ji Zhou
Microsoft Online Community Support Team

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mail a file with a macro, changing the user session Bere Excel Programming 1 September 2nd 08 12:54 AM
Macro to run RDP session alistew Excel Discussion (Misc queries) 0 February 22nd 08 11:27 AM
Startup and template locations in Citrix TS session and local session John Nurick Setting up and Configuration of Excel 2 September 21st 06 10:42 PM
Start a new session when a session is already opend MD Excel Programming 1 December 17th 05 05:47 PM
Can't alt-tab between Excel workbooks in one session. Help! LW Excel Discussion (Misc queries) 2 April 6th 05 12:42 PM


All times are GMT +1. The time now is 03:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"