Environ("appdata")

P

Pablo Cardellino

Hi,
I have a template that runs fine in my PC, with Word 2003. When I run
install it into another PC, with Word 2003 too, this line triggers an error:

path = Environ("appdata") & "\Corretor AOLP"

The error is about library not found (my friend didn't give me the right
error message)

Does anybody know how could I solve the problem, getting the desired
path, of course.

Thanks in advance,
 
K

Karl E. Peterson

Pablo said:
I have a template that runs fine in my PC, with Word 2003. When I run
install it into another PC, with Word 2003 too, this line triggers an error:

path = Environ("appdata") & "\Corretor AOLP"

The error is about library not found (my friend didn't give me the right
error message)

Does anybody know how could I solve the problem, getting the desired
path, of course.

Not sure exactly what you're asking, but (if it's what I think it is) yeah
environment variables can be "iffy" at times. To find system paths, it's *always*
best to ask the system. <g> You might find this useful...

Visual Studio Magazine Online | Classic VB Corner: Lemme Tell Ya Where To Stick
It
http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2962

It's 100% "VBA-Ready!" <tm>
 
P

Pablo Cardellino

Thanks, Karl

Karl E. Peterson escribió:
Not sure exactly what you're asking, but (if it's what I think it is) yeah
environment variables can be "iffy" at times. To find system paths, it's *always*
best to ask the system. <g> You might find this useful...

Visual Studio Magazine Online | Classic VB Corner: Lemme Tell Ya Where To Stick
It
http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2962

It's 100% "VBA-Ready!" <tm>
 
P

Pablo Cardellino

Karl E. Peterson said:
Not sure exactly what you're asking, but (if it's what I think it is) yeah
environment variables can be "iffy" at times. To find system paths, it's *always*
best to ask the system. <g> You might find this useful...

Visual Studio Magazine Online | Classic VB Corner: Lemme Tell Ya Where To Stick
It
http://visualstudiomagazine.com/columns/article.aspx?editorialsid=2962

It's 100% "VBA-Ready!" <tm>


Hi Karl, I have imported the CSysFolders.cls file into my VBA project
(within the .dot file) and I tried to use it this way:

Dim sf As New CSystemFolders
Path = sf.Path(CSIDL_APPDATA) & "\Corretor AOLP"

But an error occured: I was not possible to find the project or library, as
the script reached Space$ at this line:

Buffer = Space$(MAX_PATH)

I have never used a class before, so I guess the error must be mine. Would
you, or someone else, help me solve the problem?

Thanks in advance

Regards,
 
K

Karl E. Peterson

Hi Pablo --
Hi Karl, I have imported the CSysFolders.cls file into my VBA project
(within the .dot file) and I tried to use it this way:

Dim sf As New CSystemFolders
Path = sf.Path(CSIDL_APPDATA) & "\Corretor AOLP"

But an error occured: I was not possible to find the project or library, as
the script reached Space$ at this line:

Buffer = Space$(MAX_PATH)

I have never used a class before, so I guess the error must be mine. Would
you, or someone else, help me solve the problem?

You're not making it easy to help, I'm afraid. What was the error? Specifically.

I just created a new document, imported the class file, and added this code to the
TheDocument module:

Public Sub Test()
Dim sf As New CSystemFolders
Debug.Print sf.Path(CSIDL_APPDATA) & "\Corretor AOLP"
End Sub

It worked just fine. You'll need to provide the steps required to reproduce your
situation, in order to solve it. Or at the least, a better description of what
happens.
 
P

Pablo Cardellino

Hi, Karl

Karl E. Peterson escribió:
Hi Pablo --


You're not making it easy to help, I'm afraid. What was the error? Specifically.

I just created a new document, imported the class file, and added this code to the
TheDocument module:

Public Sub Test()
Dim sf As New CSystemFolders
Debug.Print sf.Path(CSIDL_APPDATA) & "\Corretor AOLP"
End Sub

It worked just fine. You'll need to provide the steps required to reproduce your
situation, in order to solve it. Or at the least, a better description of what
happens.

I made a typo, I wrote "I" instead of "It": the error was that *it* was
not possible to find the project or library. But the function that
trigger the error is not from your class: is the function Space(), from
the Strings library.

There are 2 situations: in my PC everything work. In most others too,
but there are some PCs in which, I don't know why, it doesn't. The error
is the same and I have noticed today that it's not related to your class
at all. As the error has nothing to do with your class, I have explained
it in another thread, with subject "To declare the library when using a
function?" (within your class, the error was triggered at firs by
Space$(), but if the scripts go ahead it happens again with all Strings
library functions.
Thank you for the support

Pablo
 
K

Karl E. Peterson

Pablo said:
I made a typo, I wrote "I" instead of "It": the error was that *it* was
not possible to find the project or library. But the function that
trigger the error is not from your class: is the function Space(), from
the Strings library.

There are 2 situations: in my PC everything work. In most others too,
but there are some PCs in which, I don't know why, it doesn't. The error
is the same and I have noticed today that it's not related to your class
at all. As the error has nothing to do with your class, I have explained
it in another thread, with subject "To declare the library when using a
function?" (within your class, the error was triggered at firs by
Space$(), but if the scripts go ahead it happens again with all Strings
library functions.

Sounds nasty. I'll look at the other thread.
 

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