?
Solved

.exe not working properly

Posted on 2003-03-21
10
Medium Priority
?
183 Views
Last Modified: 2010-05-01
here's the prob:
I made an app in VB in wich i acces a txt file containing simple text.
In design(creation) mode if i execute it read my file but when i start the compiled file(exe) it cannot open the txt file...i dont see the text and it doesn't make any error.

i did Open "Help.txt" For Input as nFic(a variable contaning FreeFile value)
since the file Help.txt is always in the same root than the main exe but its not working
is there any other way to give a not fixed path

cause my exe and txt file can be install anywhere on the pc


thanks!
0
Comment
Question by:Dayus
[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
  • 6
  • 4
10 Comments
 
LVL 2

Accepted Solution

by:
saurabhgupta earned 80 total points
ID: 8183997
Hi Dayus,
Use:
Open App.Path & IIf(Right(App.Path, 1)="\", "Help.txt", "\Help.txt") For Input as #nFic

Regards
Saurabh
0
 

Author Comment

by:Dayus
ID: 8184077
hmmm...

its not working...
it is in creation mode but as soon as it is compiled nothing...

maybe its becaus i use an install maker or something like that??
0
 

Author Comment

by:Dayus
ID: 8184095
ok

its because when i create it in the root folder of my apps with the .vbp and .frm it actually work

but as soon that i move it somewhere else even if the help.txt file is there it dont show anything
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Expert Comment

by:saurabhgupta
ID: 8184096
Dayus,
> its not working...
Does the compiled .exe not execute at all?

Regards
Saurabh
0
 

Author Comment

by:Dayus
ID: 8184132
the exe do execute

it work perfectly but it cant read the file
if it is compiled in the current folder where im doing my project it work

i can move the exe somewhere else where i could have put the txt file but it wont work but if i take my exe back in the main folder it work

seem like he attach that path with the Help.txt...

0
 

Author Comment

by:Dayus
ID: 8184148
the exe do execute

it work perfectly but it cant read the file
if it is compiled in the current folder where im doing my project it work

i can move the exe somewhere else where i could have put the txt file but it wont work but if i take my exe back in the main folder it work

seem like he attach that path with the Help.txt...

0
 
LVL 2

Expert Comment

by:saurabhgupta
ID: 8184172
Dayus,
If you have any "On Error Resume Next" statement in the code, remove it so that it does not hide errors.

Regards
Saurabh
0
 

Author Comment

by:Dayus
ID: 8184219
dont have any...

but ive check the msdn library
it says that when u use the App.path it actually taking the path of the .vbp when in cration an .exe path when its the executable that is running

well since a compiled it in the same directory than the .vbp file its normal that it only work there...since this folder represent its App.Path

so if i make my exe in a folder if it is moved away his App.Path no longer work

maybe i should put in on the server...less problem its always at the same place
...
0
 
LVL 2

Expert Comment

by:saurabhgupta
ID: 8184252
Dayus,
> well since a compiled it in the same directory than the .vbp file its normal
> that it only work there...since this folder represent its App.Path

> so if i make my exe in a folder if it is moved away his App.Path no longer work

App.Path always points to the directory the executable is currently inside, wherever you move it.

Regards
Saurabh
0
 

Author Comment

by:Dayus
ID: 8184297
well why isnt this exe dont work!

anyway ill check this out another time its not that important for the moment

ill give you the point for helping me

thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

752 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