Solved

Any alternative for CurDir?

Posted on 2004-08-22
5
439 Views
Last Modified: 2012-06-27
Good day. I am having a problem with CurDir function, which return the path to current directory. It appeared that it's not reliable. Sometime it will point to the path to my desktop, even though my VB application is at another location.

http://support.microsoft.com/default.aspx?scid=kb;en-us;80611 also discussed about the reliability of CurDir.

Is there an alternative other than CurDir without statically specified the application location (e.g. c:\programgroup\programname) ?

Thanks and hope to hear from you.
0
Comment
Question by:cwchan80
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
Farzad Akbarnejad earned 20 total points
ID: 11867572
Hi,
Use Path property of App object.

App.Path


-FA
0
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11868445
You should use public or global variable, and when application starts, you should have code like this (remember App.Path)

Public AppPath as String

Sub Main
     AppPath = App.Path
     ......
     Form1.Show
End Sub

0
 
LVL 3

Expert Comment

by:aParser
ID: 11968065
You can also use the Scripting Runtime

Set o = New Scripting.FileSystemObject
Debug.Print o.GetFolder(".").Path

And I recently found a VB2TheMax "Tip of the Day" that helped me:
Get the Command$ value from inside an ActiveX DLL
http://www.devx.com/vb2themax/Tip/18377
...which is based on the GetCommandLine API.  I see no reason why it wouldn't work inside an executable.

I'm wondering if the CurDir points to your desktop when you launch the program from an icon on your desktop.
0
 
LVL 14

Expert Comment

by:Farzad Akbarnejad
ID: 12378247
I think that my comment is correct answer but the Author must decide on correct answer.

-FA
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question