Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 3rd, 2003, 12:26 PM
Registered User
Join Date: Nov 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to read text files from CD?

In my program I need information from text files which are located
on CD-drive. But I have problems with running it from different
computers because the letter of CD-drive may also differ, so I don't know what path I should write into this code:

intFH = FreeFile()
Open "F:\Inf1.txt" For Input As intFH

I would like to know how to get the letter of CD-drive or full
path of current .exe-file
Thanks in advance for your help.

Reply With Quote
  #2 (permalink)  
Old November 3rd, 2003, 12:36 PM
Friend of Wrox
Join Date: Jun 2003
Location: McPherson, Kansas, USA.
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts

There are several things you can do to make you application more dynamic. But, in the interest of time I can only answer the one question you had. The application path or the path of the current exe as you put it can be retrieved from the the os using the App.Path() funtion in VB.

The application object has many members one of them is the Path. This will return the path where the application exe is located and running.

 Dim strCurrentPath as String

 strCurrentPath = App.Path

Give it a try. The other thoughts I have involve testing the drive using the File System Object, or using a registry setting or ini file. These can all make you application more dynamic. You can read more about the File System Object in the MDSN files - On line help.

Hope this helps.

Larry Asher
Reply With Quote
  #3 (permalink)  
Old November 3rd, 2003, 12:50 PM
Registered User
Join Date: Nov 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

It seems to work great!!!
Thank you very much, Larry:):):)

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
code to read two text files, concatenate one...... dgr7 Beginning VB 6 2 April 18th, 2007 03:24 PM
open access db from read only media (eg. CD) albertos ADO.NET 0 August 27th, 2005 06:54 PM
Install with no auto CD read gsmitchell Linux 1 October 22nd, 2004 09:34 AM
CD-R and CD -RW info wwwdirzala Beginning VB 6 0 May 4th, 2004 04:00 AM
How to read multiple text files into excel? Together Excel VBA 4 March 5th, 2004 06:26 PM

All times are GMT -4. The time now is 07:00 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.