N
Nicholas Dreyer
Assume we have an "application" workbook and a "library" workbook
called repectively application.xls and library.xls, with
application.xls using many public variables, functions and subs from
library.xls.
I would like to be able to deploy both as a package to different
users.
Since the exact path to library.xls will differ for each user, the
reference to it needs to be recreated thorugh some initialization
routine run first thing upon opening application.xls.
I have created such a routine, called
GetMyOwnLibrary
that runs fine when launched stand-alone.
Now what I would like is to launch GetMyOwnLibrary as the first thing
in a larger initialization routine in application.xls called
ActivateMyLibrary
which subsequently needs to call on many of the public variables,
functions and subs in library.xls.
Here is the rub:
Running GetMyOwnLibrary removes any preexisting reference to
library.xls and if necessary closes library.xls, which is critical for
it to be able to then add a new reference to the correct copy of
library.xls. As I said, this all works flawlessly in GetMyOwnLibrary
when run as a stand-alone routine.
However the result is that all public variables, functions and subs
from library.xls become unusable in application.xls without first
stopping and then restarting VBA. That is why running GetMyOwnLibrary
stand-alone followed by seperately running a version of
ActivateMyLibrary that includes everything but GetMyOwnLIbrary works.
However incorporating GetMyOwnLibrary as part of ActivateMyLibrary
crashes almost instantly after concluding GetMyOwnLibrary and in very
unpredictable and unpretty ways.
Is there anyway to be able to properly incorporate something like
GetMyOwnLibrary into ActivateMyLibrary? What seems to be needed is
some way to dynamically bind application.xls to all the public
variables, subs and functions in library.xls right after creating the
new reference to it. Does VBA give you that much control?
|\|.
called repectively application.xls and library.xls, with
application.xls using many public variables, functions and subs from
library.xls.
I would like to be able to deploy both as a package to different
users.
Since the exact path to library.xls will differ for each user, the
reference to it needs to be recreated thorugh some initialization
routine run first thing upon opening application.xls.
I have created such a routine, called
GetMyOwnLibrary
that runs fine when launched stand-alone.
Now what I would like is to launch GetMyOwnLibrary as the first thing
in a larger initialization routine in application.xls called
ActivateMyLibrary
which subsequently needs to call on many of the public variables,
functions and subs in library.xls.
Here is the rub:
Running GetMyOwnLibrary removes any preexisting reference to
library.xls and if necessary closes library.xls, which is critical for
it to be able to then add a new reference to the correct copy of
library.xls. As I said, this all works flawlessly in GetMyOwnLibrary
when run as a stand-alone routine.
However the result is that all public variables, functions and subs
from library.xls become unusable in application.xls without first
stopping and then restarting VBA. That is why running GetMyOwnLibrary
stand-alone followed by seperately running a version of
ActivateMyLibrary that includes everything but GetMyOwnLIbrary works.
However incorporating GetMyOwnLibrary as part of ActivateMyLibrary
crashes almost instantly after concluding GetMyOwnLibrary and in very
unpredictable and unpretty ways.
Is there anyway to be able to properly incorporate something like
GetMyOwnLibrary into ActivateMyLibrary? What seems to be needed is
some way to dynamically bind application.xls to all the public
variables, subs and functions in library.xls right after creating the
new reference to it. Does VBA give you that much control?
|\|.