PDA

View Full Version : Solved: Define constant path



CicoMico
07-11-2007, 04:58 AM
Hello! I want to define Public Const dPath = Environ("APPDATA") & "\Test" in separate module. I am getting this error: Constant expression required. Any help?
Thanx

Bob Phillips
07-11-2007, 05:08 AM
You cannot use a function in a constant definition. You need to declare it as a variable and then set it by code.

CicoMico
07-11-2007, 05:15 AM
You cannot use a function in a constant definition. You need to declare it as a variable and then set it by code.

hi! :hi: thanx. any help how to define it in one module and use it in others?

Bob Phillips
07-11-2007, 05:17 AM
Public dPath As String

Sub SetdPath()
dPath = Environ("APPDATA") & "\Test"
End Sub


use it anywhere thereafter

CicoMico
07-11-2007, 05:21 AM
I am an IDIOT! :banghead: :banghead: :banghead: :banghead: THANK YOU

mdmackillop
07-11-2007, 05:34 AM
Hi Cico,
Don't forget to mark your thread as solved.
Regards MD