VBa Choosing the wrong directory!

N

Nick Ward

Hi
I have a db located at C:\BA
when I place the following in the sub:
Dim m_strDIR
m_strDIR = Application.CurrentProject.Path & "\templates\" it works fine
debug.print m_strDIR outputted the correct C:\BA\Templates\
However when I put the same line in a Function and call it in the routine
it gives me
C:\Documents and Settings\steve\My Documents\BA\Templates\!
I tried changing the default directory to C:\BA to see if that was the
problem...
Is it me?

tia

nick
 
B

Bruce M. Thompson

I have a db located at C:\BA
when I place the following in the sub:
Dim m_strDIR
m_strDIR = Application.CurrentProject.Path & "\templates\" it works fine
debug.print m_strDIR outputted the correct C:\BA\Templates\
However when I put the same line in a Function and call it in the routine
it gives me
C:\Documents and Settings\steve\My Documents\BA\Templates\!
I tried changing the default directory to C:\BA to see if that was the
problem...
Is it me?

The value of "CurrentProject.Path" won't change as a result of referencing it
from a function or other procedure. Post the function, and how it is being
called, and I'm sure that someone will see what is happening.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top