ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to set global constants and get path of spreadsh ? (https://www.excelbanter.com/excel-programming/271352-how-set-global-constants-get-path-spreadsh.html)

wellie

How to set global constants and get path of spreadsh ?
 
Global Constants:
I've VBA functions/subs attached to various
worksheets/modules in a workbook. There are some common
constants (integer/string) among them. Can someone plz
tell me how do I set these constants as global constant
s.t. I can reference the rather then redefining them in
the sheet/module that I need to use ?

Get Path of Spreadsheet:
Can someone please tell me how can I get the current full
path where the spreadsheet is using VB code ?

Thanks for any help.

Chip Pearson

How to set global constants and get path of spreadsh ?
 
Wellie,


1) Declare the constants as Public variables in a standard code
module. E.g.,
Public Const cMyConstant = 1234

2) Use the FullName property. E.g.,
MsgBox ThisWorkbook.FullName


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"wellie" wrote in message
...
Global Constants:
I've VBA functions/subs attached to various
worksheets/modules in a workbook. There are some common
constants (integer/string) among them. Can someone plz
tell me how do I set these constants as global constant
s.t. I can reference the rather then redefining them in
the sheet/module that I need to use ?

Get Path of Spreadsheet:
Can someone please tell me how can I get the current full
path where the spreadsheet is using VB code ?

Thanks for any help.





All times are GMT +1. The time now is 07:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com