I have an external program that creates a report into excel. I execute a
report in the program and it opens excel and populates the report data (with
formatting and all).
My issue is that I have a macro I want to run against this new file that is
created - but the way the external program works it opens a new instance of
excel so any macro I have created or have open in another instance wont run
in this instance - only the other one. Is thre any way to make a macro that
is open to any instance of excel you have running ?
Thanks,
Yosef
Hi Yosef,
You can do this by creating a default workbook that contains the macro
you want available.
To do this you'd open up a blank workbook, create your macro, and then
save the workbook as a template (.xlt).
You want to call this quot;book.xltquot; and save it in your XLSTART folder
which is usually somewhere like quot;C:\Program Files\Microsoft
Office\Office11\XLStartquot;.
Then you can close the workbook and open a new instance of Excel. It
should have your macro available to run.
After testing that, test your other application to see if it works as
well.--
FastLiveHelp
Database, website, and application developer
------------------------------------------------------------------------
FastLiveHelp's Profile: www.excelforum.com/member.php...oamp;userid=31779
View this thread: www.excelforum.com/showthread...hreadid=515019Thanks - Ill try it.
But does tgis mean I have to copy the xlt file into anyones PC that needs
the macro ?
quot;FastLiveHelpquot; wrote:
gt;
gt; Hi Yosef,
gt;
gt; You can do this by creating a default workbook that contains the macro
gt; you want available.
gt;
gt; To do this you'd open up a blank workbook, create your macro, and then
gt; save the workbook as a template (.xlt).
gt;
gt; You want to call this quot;book.xltquot; and save it in your XLSTART folder
gt; which is usually somewhere like quot;C:\Program Files\Microsoft
gt; Office\Office11\XLStartquot;.
gt;
gt; Then you can close the workbook and open a new instance of Excel. It
gt; should have your macro available to run.
gt;
gt; After testing that, test your other application to see if it works as
gt; well.
gt;
gt;
gt; --
gt; FastLiveHelp
gt;
gt; Database, website, and application developer
gt; ------------------------------------------------------------------------
gt; FastLiveHelp's Profile: www.excelforum.com/member.php...oamp;userid=31779
gt; View this thread: www.excelforum.com/showthread...hreadid=515019
gt;
gt;
I wouldn't use a .xlt file for this.
I'd create the macro, but store it in a workbook that was saved as .xla (excel
addin).
And then I'd share that addin with anyone who needed the macro.
If possible, I think I'd put it on a network share and have the other users
install the addin via Tools|addins|browse. Then I'd only have to update one
file when something changed.
But if not all the users have access to a common network drive, you could email
the workbook (still .xla) and tell them to store it where they want.
And still use tools|addins|browse to install it.
And to give them a way to run that macro, I'd either use stuff added to the
worksheet menubar or a dedicated toolbar.
I really like the way John Walkenbach does it in his menumaker workbook:
j-walk.com/ss/excel/tips/tip53.htm
Here's how I do it when I want a toolbar:
www.contextures.com/xlToolbar02.html
(from Debra Dalgleish's site)
ynissel wrote:
gt;
gt; I have an external program that creates a report into excel. I execute a
gt; report in the program and it opens excel and populates the report data (with
gt; formatting and all).
gt;
gt; My issue is that I have a macro I want to run against this new file that is
gt; created - but the way the external program works it opens a new instance of
gt; excel so any macro I have created or have open in another instance wont run
gt; in this instance - only the other one. Is thre any way to make a macro that
gt; is open to any instance of excel you have running ?
gt;
gt; Thanks,
gt; Yosef
--
Dave Peterson
To do it this way you would need them to have this book.xlt file in
their XLStart folder yes.
Another way to do this is to have an open workbook that has the public
macro in it. Any other open workbook can then execute public macros
from that open workbook.
To test this you can create a workbook with a public macro in it, then
save that workbook and re-open it to be sure macros are enabled with
it.
Then open up a blank workbook and hit Alt-F8 to get the list of macros
you can run. As long as the quot;Macros Inquot; box says quot;All Open Workbooksquot;
you should see your macro from the other workbook available.
An example of a public macro is:
Public Sub TestSub()
MsgBox quot;Hello Worldquot;
End Sub
This could be in a module or in a worksheet. The reference to it from
another workbook would point to the workbookname and sheet if
necesarry. You'll see this when you do the Alt-F8.
Does that help?--
FastLiveHelp
Database, website, and application developer
------------------------------------------------------------------------
FastLiveHelp's Profile: www.excelforum.com/member.php...oamp;userid=31779
View this thread: www.excelforum.com/showthread...hreadid=515019Dave - I tried it your way - crated the macro in a worksheet saved it as an
xla. brought it in as an add-in but it still didnt show up ? when I go to
the macro menu option - I dont see any macro ?
What am I doing wrong ?
quot;Dave Petersonquot; wrote:
gt; I wouldn't use a .xlt file for this.
gt;
gt; I'd create the macro, but store it in a workbook that was saved as .xla (excel
gt; addin).
gt;
gt; And then I'd share that addin with anyone who needed the macro.
gt;
gt; If possible, I think I'd put it on a network share and have the other users
gt; install the addin via Tools|addins|browse. Then I'd only have to update one
gt; file when something changed.
gt;
gt; But if not all the users have access to a common network drive, you could email
gt; the workbook (still .xla) and tell them to store it where they want.
gt;
gt; And still use tools|addins|browse to install it.
gt;
gt; And to give them a way to run that macro, I'd either use stuff added to the
gt; worksheet menubar or a dedicated toolbar.
gt;
gt; I really like the way John Walkenbach does it in his menumaker workbook:
gt; j-walk.com/ss/excel/tips/tip53.htm
gt;
gt; Here's how I do it when I want a toolbar:
gt; www.contextures.com/xlToolbar02.html
gt; (from Debra Dalgleish's site)
gt;
gt;
gt;
gt; ynissel wrote:
gt; gt;
gt; gt; I have an external program that creates a report into excel. I execute a
gt; gt; report in the program and it opens excel and populates the report data (with
gt; gt; formatting and all).
gt; gt;
gt; gt; My issue is that I have a macro I want to run against this new file that is
gt; gt; created - but the way the external program works it opens a new instance of
gt; gt; excel so any macro I have created or have open in another instance wont run
gt; gt; in this instance - only the other one. Is thre any way to make a macro that
gt; gt; is open to any instance of excel you have running ?
gt; gt;
gt; gt; Thanks,
gt; gt; Yosef
gt;
gt; --
gt;
gt; Dave Peterson
gt;
Subs in .xla's aren't visible via the Tools|macro|macros dialog.
That's why I suggested:
gt; gt; And to give them a way to run that macro, I'd either use stuff added to the
gt; gt; worksheet menubar or a dedicated toolbar.
gt; gt;
gt; gt; I really like the way John Walkenbach does it in his menumaker workbook:
gt; gt; j-walk.com/ss/excel/tips/tip53.htm
gt; gt;
gt; gt; Here's how I do it when I want a toolbar:
gt; gt; www.contextures.com/xlToolbar02.html
gt; gt; (from Debra Dalgleish's site)
ynissel wrote:
gt;
gt; Dave - I tried it your way - crated the macro in a worksheet saved it as an
gt; xla. brought it in as an add-in but it still didnt show up ? when I go to
gt; the macro menu option - I dont see any macro ?
gt; What am I doing wrong ?
gt;
gt; quot;Dave Petersonquot; wrote:
gt;
gt; gt; I wouldn't use a .xlt file for this.
gt; gt;
gt; gt; I'd create the macro, but store it in a workbook that was saved as .xla (excel
gt; gt; addin).
gt; gt;
gt; gt; And then I'd share that addin with anyone who needed the macro.
gt; gt;
gt; gt; If possible, I think I'd put it on a network share and have the other users
gt; gt; install the addin via Tools|addins|browse. Then I'd only have to update one
gt; gt; file when something changed.
gt; gt;
gt; gt; But if not all the users have access to a common network drive, you could email
gt; gt; the workbook (still .xla) and tell them to store it where they want.
gt; gt;
gt; gt; And still use tools|addins|browse to install it.
gt; gt;
gt; gt; And to give them a way to run that macro, I'd either use stuff added to the
gt; gt; worksheet menubar or a dedicated toolbar.
gt; gt;
gt; gt; I really like the way John Walkenbach does it in his menumaker workbook:
gt; gt; j-walk.com/ss/excel/tips/tip53.htm
gt; gt;
gt; gt; Here's how I do it when I want a toolbar:
gt; gt; www.contextures.com/xlToolbar02.html
gt; gt; (from Debra Dalgleish's site)
gt; gt;
gt; gt;
gt; gt;
gt; gt; ynissel wrote:
gt; gt; gt;
gt; gt; gt; I have an external program that creates a report into excel. I execute a
gt; gt; gt; report in the program and it opens excel and populates the report data (with
gt; gt; gt; formatting and all).
gt; gt; gt;
gt; gt; gt; My issue is that I have a macro I want to run against this new file that is
gt; gt; gt; created - but the way the external program works it opens a new instance of
gt; gt; gt; excel so any macro I have created or have open in another instance wont run
gt; gt; gt; in this instance - only the other one. Is thre any way to make a macro that
gt; gt; gt; is open to any instance of excel you have running ?
gt; gt; gt;
gt; gt; gt; Thanks,
gt; gt; gt; Yosef
gt; gt;
gt; gt; --
gt; gt;
gt; gt; Dave Peterson
gt; gt;
--
Dave Peterson
I feel like a serious novice.
I am having such problems either trying to follow the directions or excel
isnt cooperating.
I finally got it to work and the toolbar opens up when I launch excel - but
when the external program launches excel it still doesnt show up. when I go
to add-in - its checked off !
What am I doing wrong ????quot;Dave Petersonquot; wrote:
gt; Subs in .xla's aren't visible via the Tools|macro|macros dialog.
gt;
gt; That's why I suggested:
gt;
gt; gt; gt; And to give them a way to run that macro, I'd either use stuff added to the
gt; gt; gt; worksheet menubar or a dedicated toolbar.
gt; gt; gt;
gt; gt; gt; I really like the way John Walkenbach does it in his menumaker workbook:
gt; gt; gt; j-walk.com/ss/excel/tips/tip53.htm
gt; gt; gt;
gt; gt; gt; Here's how I do it when I want a toolbar:
gt; gt; gt; www.contextures.com/xlToolbar02.html
gt; gt; gt; (from Debra Dalgleish's site)
gt;
gt; ynissel wrote:
gt; gt;
gt; gt; Dave - I tried it your way - crated the macro in a worksheet saved it as an
gt; gt; xla. brought it in as an add-in but it still didnt show up ? when I go to
gt; gt; the macro menu option - I dont see any macro ?
gt; gt; What am I doing wrong ?
gt; gt;
gt; gt; quot;Dave Petersonquot; wrote:
gt; gt;
gt; gt; gt; I wouldn't use a .xlt file for this.
gt; gt; gt;
gt; gt; gt; I'd create the macro, but store it in a workbook that was saved as .xla (excel
gt; gt; gt; addin).
gt; gt; gt;
gt; gt; gt; And then I'd share that addin with anyone who needed the macro.
gt; gt; gt;
gt; gt; gt; If possible, I think I'd put it on a network share and have the other users
gt; gt; gt; install the addin via Tools|addins|browse. Then I'd only have to update one
gt; gt; gt; file when something changed.
gt; gt; gt;
gt; gt; gt; But if not all the users have access to a common network drive, you could email
gt; gt; gt; the workbook (still .xla) and tell them to store it where they want.
gt; gt; gt;
gt; gt; gt; And still use tools|addins|browse to install it.
gt; gt; gt;
gt; gt; gt; And to give them a way to run that macro, I'd either use stuff added to the
gt; gt; gt; worksheet menubar or a dedicated toolbar.
gt; gt; gt;
gt; gt; gt; I really like the way John Walkenbach does it in his menumaker workbook:
gt; gt; gt; j-walk.com/ss/excel/tips/tip53.htm
gt; gt; gt;
gt; gt; gt; Here's how I do it when I want a toolbar:
gt; gt; gt; www.contextures.com/xlToolbar02.html
gt; gt; gt; (from Debra Dalgleish's site)
gt; gt; gt;
gt; gt; gt;
gt; gt; gt;
gt; gt; gt; ynissel wrote:
gt; gt; gt; gt;
gt; gt; gt; gt; I have an external program that creates a report into excel. I execute a
gt; gt; gt; gt; report in the program and it opens excel and populates the report data (with
gt; gt; gt; gt; formatting and all).
gt; gt; gt; gt;
gt; gt; gt; gt; My issue is that I have a macro I want to run against this new file that is
gt; gt; gt; gt; created - but the way the external program works it opens a new instance of
gt; gt; gt; gt; excel so any macro I have created or have open in another instance wont run
gt; gt; gt; gt; in this instance - only the other one. Is thre any way to make a macro that
gt; gt; gt; gt; is open to any instance of excel you have running ?
gt; gt; gt; gt;
gt; gt; gt; gt; Thanks,
gt; gt; gt; gt; Yosef
gt; gt; gt;
gt; gt; gt; --
gt; gt; gt;
gt; gt; gt; Dave Peterson
gt; gt; gt;
gt;
gt; --
gt;
gt; Dave Peterson
gt;
How is your external program launching excel?
If you're automating it (createobject???), you'll have to load the addin
yourself in the code that launches excel.
ynissel wrote:
gt;
gt; I feel like a serious novice.
gt; I am having such problems either trying to follow the directions or excel
gt; isnt cooperating.
gt; I finally got it to work and the toolbar opens up when I launch excel - but
gt; when the external program launches excel it still doesnt show up. when I go
gt; to add-in - its checked off !
gt; What am I doing wrong ????
gt;
gt; quot;Dave Petersonquot; wrote:
gt;
gt; gt; Subs in .xla's aren't visible via the Tools|macro|macros dialog.
gt; gt;
gt; gt; That's why I suggested:
gt; gt;
gt; gt; gt; gt; And to give them a way to run that macro, I'd either use stuff added to the
gt; gt; gt; gt; worksheet menubar or a dedicated toolbar.
gt; gt; gt; gt;
gt; gt; gt; gt; I really like the way John Walkenbach does it in his menumaker workbook:
gt; gt; gt; gt; j-walk.com/ss/excel/tips/tip53.htm
gt; gt; gt; gt;
gt; gt; gt; gt; Here's how I do it when I want a toolbar:
gt; gt; gt; gt; www.contextures.com/xlToolbar02.html
gt; gt; gt; gt; (from Debra Dalgleish's site)
gt; gt;
gt; gt; ynissel wrote:
gt; gt; gt;
gt; gt; gt; Dave - I tried it your way - crated the macro in a worksheet saved it as an
gt; gt; gt; xla. brought it in as an add-in but it still didnt show up ? when I go to
gt; gt; gt; the macro menu option - I dont see any macro ?
gt; gt; gt; What am I doing wrong ?
gt; gt; gt;
gt; gt; gt; quot;Dave Petersonquot; wrote:
gt; gt; gt;
gt; gt; gt; gt; I wouldn't use a .xlt file for this.
gt; gt; gt; gt;
gt; gt; gt; gt; I'd create the macro, but store it in a workbook that was saved as .xla (excel
gt; gt; gt; gt; addin).
gt; gt; gt; gt;
gt; gt; gt; gt; And then I'd share that addin with anyone who needed the macro.
gt; gt; gt; gt;
gt; gt; gt; gt; If possible, I think I'd put it on a network share and have the other users
gt; gt; gt; gt; install the addin via Tools|addins|browse. Then I'd only have to update one
gt; gt; gt; gt; file when something changed.
gt; gt; gt; gt;
gt; gt; gt; gt; But if not all the users have access to a common network drive, you could email
gt; gt; gt; gt; the workbook (still .xla) and tell them to store it where they want.
gt; gt; gt; gt;
gt; gt; gt; gt; And still use tools|addins|browse to install it.
gt; gt; gt; gt;
gt; gt; gt; gt; And to give them a way to run that macro, I'd either use stuff added to the
gt; gt; gt; gt; worksheet menubar or a dedicated toolbar.
gt; gt; gt; gt;
gt; gt; gt; gt; I really like the way John Walkenbach does it in his menumaker workbook:
gt; gt; gt; gt; j-walk.com/ss/excel/tips/tip53.htm
gt; gt; gt; gt;
gt; gt; gt; gt; Here's how I do it when I want a toolbar:
gt; gt; gt; gt; www.contextures.com/xlToolbar02.html
gt; gt; gt; gt; (from Debra Dalgleish's site)
gt; gt; gt; gt;
gt; gt; gt; gt;
gt; gt; gt; gt;
gt; gt; gt; gt; ynissel wrote:
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; I have an external program that creates a report into excel. I execute a
gt; gt; gt; gt; gt; report in the program and it opens excel and populates the report data (with
gt; gt; gt; gt; gt; formatting and all).
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; My issue is that I have a macro I want to run against this new file that is
gt; gt; gt; gt; gt; created - but the way the external program works it opens a new instance of
gt; gt; gt; gt; gt; excel so any macro I have created or have open in another instance wont run
gt; gt; gt; gt; gt; in this instance - only the other one. Is thre any way to make a macro that
gt; gt; gt; gt; gt; is open to any instance of excel you have running ?
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; Thanks,
gt; gt; gt; gt; gt; Yosef
gt; gt; gt; gt;
gt; gt; gt; gt; --
gt; gt; gt; gt;
gt; gt; gt; gt; Dave Peterson
gt; gt; gt; gt;
gt; gt;
gt; gt; --
gt; gt;
gt; gt; Dave Peterson
gt; gt;
--
Dave Peterson
I dont know hoe its launching. from within the app I generate report and it
automatically opens excel with the report there !
quot;Dave Petersonquot; wrote:
gt; How is your external program launching excel?
gt;
gt; If you're automating it (createobject???), you'll have to load the addin
gt; yourself in the code that launches excel.
gt;
gt;
gt;
gt; ynissel wrote:
gt; gt;
gt; gt; I feel like a serious novice.
gt; gt; I am having such problems either trying to follow the directions or excel
gt; gt; isnt cooperating.
gt; gt; I finally got it to work and the toolbar opens up when I launch excel - but
gt; gt; when the external program launches excel it still doesnt show up. when I go
gt; gt; to add-in - its checked off !
gt; gt; What am I doing wrong ????
gt; gt;
gt; gt; quot;Dave Petersonquot; wrote:
gt; gt;
gt; gt; gt; Subs in .xla's aren't visible via the Tools|macro|macros dialog.
gt; gt; gt;
gt; gt; gt; That's why I suggested:
gt; gt; gt;
gt; gt; gt; gt; gt; And to give them a way to run that macro, I'd either use stuff added to the
gt; gt; gt; gt; gt; worksheet menubar or a dedicated toolbar.
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; I really like the way John Walkenbach does it in his menumaker workbook:
gt; gt; gt; gt; gt; j-walk.com/ss/excel/tips/tip53.htm
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; Here's how I do it when I want a toolbar:
gt; gt; gt; gt; gt; www.contextures.com/xlToolbar02.html
gt; gt; gt; gt; gt; (from Debra Dalgleish's site)
gt; gt; gt;
gt; gt; gt; ynissel wrote:
gt; gt; gt; gt;
gt; gt; gt; gt; Dave - I tried it your way - crated the macro in a worksheet saved it as an
gt; gt; gt; gt; xla. brought it in as an add-in but it still didnt show up ? when I go to
gt; gt; gt; gt; the macro menu option - I dont see any macro ?
gt; gt; gt; gt; What am I doing wrong ?
gt; gt; gt; gt;
gt; gt; gt; gt; quot;Dave Petersonquot; wrote:
gt; gt; gt; gt;
gt; gt; gt; gt; gt; I wouldn't use a .xlt file for this.
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; I'd create the macro, but store it in a workbook that was saved as .xla (excel
gt; gt; gt; gt; gt; addin).
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; And then I'd share that addin with anyone who needed the macro.
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; If possible, I think I'd put it on a network share and have the other users
gt; gt; gt; gt; gt; install the addin via Tools|addins|browse. Then I'd only have to update one
gt; gt; gt; gt; gt; file when something changed.
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; But if not all the users have access to a common network drive, you could email
gt; gt; gt; gt; gt; the workbook (still .xla) and tell them to store it where they want.
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; And still use tools|addins|browse to install it.
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; And to give them a way to run that macro, I'd either use stuff added to the
gt; gt; gt; gt; gt; worksheet menubar or a dedicated toolbar.
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; I really like the way John Walkenbach does it in his menumaker workbook:
gt; gt; gt; gt; gt; j-walk.com/ss/excel/tips/tip53.htm
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; Here's how I do it when I want a toolbar:
gt; gt; gt; gt; gt; www.contextures.com/xlToolbar02.html
gt; gt; gt; gt; gt; (from Debra Dalgleish's site)
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; ynissel wrote:
gt; gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; gt; I have an external program that creates a report into excel. I execute a
gt; gt; gt; gt; gt; gt; report in the program and it opens excel and populates the report data (with
gt; gt; gt; gt; gt; gt; formatting and all).
gt; gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; gt; My issue is that I have a macro I want to run against this new file that is
gt; gt; gt; gt; gt; gt; created - but the way the external program works it opens a new instance of
gt; gt; gt; gt; gt; gt; excel so any macro I have created or have open in another instance wont run
gt; gt; gt; gt; gt; gt; in this instance - only the other one. Is thre any way to make a macro that
gt; gt; gt; gt; gt; gt; is open to any instance of excel you have running ?
gt; gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; gt; Thanks,
gt; gt; gt; gt; gt; gt; Yosef
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; --
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; Dave Peterson
gt; gt; gt; gt; gt;
gt; gt; gt;
gt; gt; gt; --
gt; gt; gt;
gt; gt; gt; Dave Peterson
gt; gt; gt;
gt;
gt; --
gt;
gt; Dave Peterson
gt;
- Feb 22 Thu 2007 20:35
general macro question
close
全站熱搜
留言列表
發表留言