View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
jswalsh33 jswalsh33 is offline
external usenet poster
 
Posts: 51
Default Separate Macro from Workbook

Gord,

I loaded your suggestion and was able save the add-in, bring up the add-in
when I opened the Worksheet with the databases and de-load the add-in when
the workbook is closed. I can see the macros in the macro list of the add-in.

However, I am missing something. I cannot run the macros from the database
workbook. I get a message that the program can't find the macro I am trying
to run. The macros are called by command buttons in the database workbook.

Help?

Thanks,

Jim Walsh

"Gord Dibben" wrote:

FileSave AsFile Type. Scroll down to Add-in


Gord

On Sun, 25 Oct 2009 16:01:01 -0700, jswalsh33
wrote:

Gord,

Thanks again,

I think what you suggest will do the job. The program may or may not be on a
network.

I will give it a try and let you know how I make out. I am not quite sure
how to save a workbook as an "add-in, but I will try to figure it out.

Jim Walsh

"Gord Dibben" wrote:

Having a "control person" leads me to believe you're on a network.

True?

You may be best off in that case to put all the macros in a new workbook
then save it as an addin stored where all users have access.

No need for any macros in the database workbooks that users are working on
and any updates/changes to the add-in are only done in one place.

Unless you wanted some workbook_open code in the DB workbooks to load the
add-in for each user when they open their copy of DB workbook.

Private Sub Workbook_Open()
AddIns("addin_name").Installed = True
End Sub

Then unload when workbook is closed if you wish.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
AddIns("addin_name").Installed = False
End Sub

Or just rely on users to load the add-in themselves.


Gord

On Sun, 25 Oct 2009 07:14:01 -0700, jswalsh33
wrote:

Gord,

Thanks for your interest.

I have a workbook with a large number of macros.

The workbook contains three databases. Different users use copies of the
workbook and have different data in the databases.

The Macro's may be changed from time to time by a control person and should
apply to all users workbooks.

Therefore, I would like to have a common set of macros apply to the
workbooks of each user as the workbooks are opened.

Your response of deleting Macro's when the workbook is closed would seem to
apply if I could then reestablish the common macro set when reopening any of
the workbooks.

Please give me a clue on that one and I will try it.

Thanks,

Jim Walsh

"Gord Dibben" wrote:

Been following this and not sure what OP is after.

First talks about Personal Macro Workbook being in XLSTART folder and
opening hidden, then asks "can the same be done for certain Excel workbooks
but not others?"

Does OP want to have more workbooks in XLSTART folder that open hidden?

Yes is the answer to that.

Does OP want some macros available for some workbooks but not have
Personal.xls open all the time.

Also Yes to that.

Can you have macros in a workbook and save the workbook and delete the
macros when saving.

Yes to that also.

OP needs to describe needs in more detail.


Gord Dibben MS Excel MVP

On Fri, 23 Oct 2009 12:04:01 -0700, FSt1
wrote:

hi
no really. the vb part and the file are intergrated. saving saves all. if
there is a way around it, i don't know it.

Regards
FSt1

"jswalsh33" wrote:

You answered the real question, which was can the macros and the workbook be
separated.

What I was trying to do was to save changes in the workbook and not save
changes in the macros.

Any ideas on that one?

Thanks,

Jim Walsh


"FSt1" wrote:

hi
you seem to have two questions.
subject:Separate macro from workbook.
no. can't be done.
not sure about your second question. if it's in the xls start folder, it
will open with excel and all macros in the open workbooks can be use on other
files provided they are generic ie make no reference to a specific workbook
name or worksheet name.

if i didn't answer your question, post back with more detail.

Regards
FSt1

"jswalsh33" wrote:

In response to a question on allowing a macro to be available for all files
in Excel dated 5/17/09, FST1 wrote a solution that did what was requested.

Namely:
C:\Program Files\Microsoft Office\Office12\XLSTART (i think).
The file will open automaticly(hidden) when excel starts and all macros in
the personal.xlsb will be available for use on all files.

My question is can the same be done for certain Excel workbooks but not
others?

Any help will be greatly appreciated.

Jim Walsh

.


.


.