#1
|
|||
|
|||
Macro to determine if word or excel application is being used
Hi
I have a print macro for word and one for excel. I want to combine these two. So I need my macro to: a) Determine first which application its being called from (Word or Excel) b) Call either the Excel or Word print macro depending on point (a)'s selection. Thanks in advance. |
#2
|
|||
|
|||
Code:
Sub whichApp() dim sApp as String sApp = Application.Name msgBox "Application is " & sApp End Sub |
#3
|
||||
|
||||
Quote:
In any event, unless your print macro is re-written as a vbscript (which is stored in a file on its own and requires it own automation by each calling application), you can't have the two applications call the shared macro without each application having a macro of its own to call the shared one, which kind of defeats the purpose. If the code isn't re-written as a vbscript and one application hosts the macro, whichever application doesn't host it will have to automate the other one to do the printing on it's behalf, thus requiring far more code than you'll ever be likely to save.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
application wide macro | ronaldo.k | PowerPoint | 1 | 11-21-2013 11:31 AM |
cannot start the source application for this object - Excel | charlesmac | Excel | 3 | 08-15-2012 05:22 AM |
A word macro application | Hikmetotheron | Word | 3 | 04-26-2011 02:01 PM |
Macro to determine attached template | zippyaus | Word VBA | 0 | 03-02-2010 02:05 AM |
Excel 2003 will not terminate with application.quit | Peter Schellenbach | Excel | 12 | 03-14-2006 05:28 PM |