Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MD MD is offline
external usenet poster
 
Posts: 26
Default Public constant in many workbooks

How or is it possible to declare a Public Const that will be aplied to ALL
workbooks opened (just in one workbook). The reason is I have 25 workbooks
that are all interlinked somehow. I declare my paths in each of these
workbooks. But if I modify this path, I then need to correct all 25
workbooks.

I've tried to incorporate an import of a text file via VBE with the
modifications in it, but I need to restart the application in order for the
Public Const to be activated.

TIA

MD


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Public constant in many workbooks

Why does it have to be a constant. You can have public variables. Since
the values really aren't constant, why not have public variables and
populate them each time from your file.
--
Regards,
Tom Ogilvy

"MD" wrote in message
. ..
How or is it possible to declare a Public Const that will be aplied to ALL
workbooks opened (just in one workbook). The reason is I have 25

workbooks
that are all interlinked somehow. I declare my paths in each of these
workbooks. But if I modify this path, I then need to correct all 25
workbooks.

I've tried to incorporate an import of a text file via VBE with the
modifications in it, but I need to restart the application in order for

the
Public Const to be activated.

TIA

MD




  #3   Report Post  
Posted to microsoft.public.excel.programming
MD MD is offline
external usenet poster
 
Posts: 26
Default Public constant in many workbooks



The variables are in fact constant. The only reason they change is if the
installation of the program is done in an other drive.
Say that I do Public Const Drive = "C:\"

In a sub I would have something like this
Workbooks.Open Filename:=Drive + "\MyFolder1\MyFile.xls",
UpdateLinks:=0, ReadOnly:=True
If the program is installed on a D Drive , I need to change the value of my
Drive variable to D: and repeat this on all 25 workbooks.

The value of the variable is changed only after the initial installation.


"Tom Ogilvy" a écrit dans le message de
...
Why does it have to be a constant. You can have public variables. Since
the values really aren't constant, why not have public variables and
populate them each time from your file.
--
Regards,
Tom Ogilvy

"MD" wrote in message
. ..
How or is it possible to declare a Public Const that will be aplied to

ALL
workbooks opened (just in one workbook). The reason is I have 25

workbooks
that are all interlinked somehow. I declare my paths in each of these
workbooks. But if I modify this path, I then need to correct all 25
workbooks.

I've tried to incorporate an import of a text file via VBE with the
modifications in it, but I need to restart the application in order for

the
Public Const to be activated.

TIA

MD






  #4   Report Post  
Posted to microsoft.public.excel.programming
MD MD is offline
external usenet poster
 
Posts: 26
Default Public constant in many workbooks

I was thinking, perhaps if there is a way to inclued in a auto_open sub a
search for the "root" directoryof the program, after it has found that
directory isolate the drive value and declare it as a Public Const then.!!!!

So each time Myfile.xls is called, no matter where it is, when the code is
executed, the auto_open will have found the drive where the program is
installed in.

Hummmm....any suggestions!!!! LOL



"Tom Ogilvy" a écrit dans le message de
...
Why does it have to be a constant. You can have public variables. Since
the values really aren't constant, why not have public variables and
populate them each time from your file.
--
Regards,
Tom Ogilvy

"MD" wrote in message
. ..
How or is it possible to declare a Public Const that will be aplied to

ALL
workbooks opened (just in one workbook). The reason is I have 25

workbooks
that are all interlinked somehow. I declare my paths in each of these
workbooks. But if I modify this path, I then need to correct all 25
workbooks.

I've tried to incorporate an import of a text file via VBE with the
modifications in it, but I need to restart the application in order for

the
Public Const to be activated.

TIA

MD






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Public constant in many workbooks

workbooks("Myfile.xls").Path

should show you where the file is. Or if the code is in Myfile.xls, use

thisworkbook.path everywhere you would have used a constant.



--
Regards,
Tom Ogilvy

"MD" wrote in message
. ..
I was thinking, perhaps if there is a way to inclued in a auto_open sub a
search for the "root" directoryof the program, after it has found that
directory isolate the drive value and declare it as a Public Const

then.!!!!

So each time Myfile.xls is called, no matter where it is, when the code is
executed, the auto_open will have found the drive where the program is
installed in.

Hummmm....any suggestions!!!! LOL



"Tom Ogilvy" a écrit dans le message de
...
Why does it have to be a constant. You can have public variables.

Since
the values really aren't constant, why not have public variables and
populate them each time from your file.
--
Regards,
Tom Ogilvy

"MD" wrote in message
. ..
How or is it possible to declare a Public Const that will be aplied to

ALL
workbooks opened (just in one workbook). The reason is I have 25

workbooks
that are all interlinked somehow. I declare my paths in each of these
workbooks. But if I modify this path, I then need to correct all 25
workbooks.

I've tried to incorporate an import of a text file via VBE with the
modifications in it, but I need to restart the application in order

for
the
Public Const to be activated.

TIA

MD








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Constant loan payments vs. constant payments of principal lalli945 Excel Worksheet Functions 3 December 20th 06 10:33 PM
How do I make my functions public to all workbooks? DMB Excel Discussion (Misc queries) 3 February 16th 06 02:20 PM
Constant between workbooks Krmsy Excel Discussion (Misc queries) 1 January 18th 06 03:43 PM
Public Sub Help No Name Excel Programming 2 May 18th 04 11:09 PM
Enter a constant into Ten Workbooks JMay Excel Programming 2 November 5th 03 03:01 AM


All times are GMT +1. The time now is 10:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"