We help IT Professionals succeed at work.

vb6 get file from path

XK8ER
XK8ER asked
on
Medium Priority
1,530 Views
Last Modified: 2012-05-06
hello,
I am using VB6. i have a string that contains a path + file name.
such as c:\temp\some folder\myFile.zip.
what is the best way to get the myFile.zip?

thanks
Comment
Watch Question


good morning!
u can use the file system object..

try this approach....

Public FSO As New FileSystemObject

FSO.getFile "c:\temp\some folder\myFile.zip"

then you will get the file "myFile.zip"



i hope i can give u some idea...

game-master

Author

Commented:
im trying this but its not working!

lblFile.Caption = FSO.GetFile("c:\temp\some folder\myFile.zip")

are u trying the put the name of the file to the label caption?

this is the way to do it...

dim myFile as File

myFile = FSO.getFile "c:\temp\some folder\myFile.zip"
lblFile.Caption = myFile.Name

*** if u want to know other information about the file, just select when you type the " . " after the myFile


i hope i can give u idea.

game-master
CERTIFIED EXPERT
Top Expert 2010
Commented:
Debug.Print Mid(SomeString, InStrRev(SomeString, "\") + 1)

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.