View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default global 'path' declaration

If docpath is declared as a constant in ThisWorkbook, you can't declare it
as public and thus I don't believe you can use ThisWorkbook.docPath to refer
to it. At least it doesn't work in xl2003 in my tests.

--
Regards,
Tom Ogilvy

"Chip Pearson" wrote in message
...
Don't declare it in ThisWorkbook. Declare the constant in a
regular code module. If you do declare it in ThisWorkbook, you
need to reference the variable as ThisWorkbook.docPath.




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


"Gixxer_J_97" wrote in
message
...
Hi all

i need to have a global 'path' that all of my functions and
subs have access
to, so that if i want to change the path, i need to change it
only in one
place

i have

const docPath="C:\Temp\"

defined in ThisWorkbook, but when i open the workbook and run
any of my
functions trying to reference docPath, it is empty

is defining it as a const in ThisWorkbook not setting it
public?
or do i need to do

public docPath

Private Sub Workbook_Open()
docPath = "C:\Temp\"
End Sub

?

doesn't that allow the path to be changed from other functions?

any suggestions greatly appreciated!

thanks!

J