By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,940 Members | 614 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,940 IT Pros & Developers. It's quick & easy.

How to reference my constants declared in an xl module

P: n/a
Good Evening

I am importing data from an excel application into access.My excel app
has important constants declared in one of its modules that relate to the
worksheet columns.I need to refer to these same constants from access . I
dont wish to combine both apps into 1 big app and I certainly dont wish to
declare them again in access as the excel constants declarations may change
periodically .

Any suggestions

Thanking you

Tony
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Fri, 31 Oct 2003 08:49:42 +1300, "Tony Miller"
<tc***************@xtra.co.nz> wrote:

I'm not an expert on this, but I think you can't reference global
constants. However, you *can* call a public function, so then the task
becomes to write a function in Excel like this:
Public Function GetGLobalVariable(byval strVariable as String) as
Variant
select case strVariable
case "MyFirstGlobalVariable"
GetGlobalVariable = MY_FIRST_GLOBAL_VAR
'etc
end select
end function

-Tom.

Good Evening

I am importing data from an excel application into access.My excel app
has important constants declared in one of its modules that relate to the
worksheet columns.I need to refer to these same constants from access . I
dont wish to combine both apps into 1 big app and I certainly dont wish to
declare them again in access as the excel constants declarations may change
periodically .

Any suggestions

Thanking you

Tony


Nov 12 '05 #2

P: n/a
Rather than import the Excel data, link to the Excel data. Excel will continue
to make use of the constants and if they change, the linked data that uses the
constants will automatically change accordingly.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
www.pcdatasheet.com
"Tony Miller" <tc***************@xtra.co.nz> wrote in message
news:rX******************@news.xtra.co.nz...
Good Evening

I am importing data from an excel application into access.My excel app
has important constants declared in one of its modules that relate to the
worksheet columns.I need to refer to these same constants from access . I
dont wish to combine both apps into 1 big app and I certainly dont wish to
declare them again in access as the excel constants declarations may change
periodically .

Any suggestions

Thanking you

Tony

Nov 12 '05 #3

P: n/a
Thanks Tom

The function works well.After looking around I found the run method will
call the function
I added the following lines in access to call the xl function

Set xlapp = GetObject(, "Excel.application")

x = xlapp.Run("MyWorkbook.xls!GetGlobalVariable", "myconststr")

"Tom van Stiphout" <to*****@no.spam.cox.net> wrote in message
news:2q********************************@4ax.com...
On Fri, 31 Oct 2003 08:49:42 +1300, "Tony Miller"
<tc***************@xtra.co.nz> wrote:

I'm not an expert on this, but I think you can't reference global
constants. However, you *can* call a public function, so then the task
becomes to write a function in Excel like this:
Public Function GetGLobalVariable(byval strVariable as String) as
Variant
select case strVariable
case "MyFirstGlobalVariable"
GetGlobalVariable = MY_FIRST_GLOBAL_VAR
'etc
end select
end function

-Tom.

Good Evening

I am importing data from an excel application into access.My excel apphas important constants declared in one of its modules that relate to the
worksheet columns.I need to refer to these same constants from access . I
dont wish to combine both apps into 1 big app and I certainly dont wish todeclare them again in access as the excel constants declarations may changeperiodically .

Any suggestions

Thanking you

Tony

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.