Hi, everyone!
I'm kind of in a hurry. I need to know for tomorrow how can I open a file and get the file name.
I was using the Common Dialog and with ".Filename" I could be able to get the name. It was easy and it worked!!
The point is that when I'm trying to open this program (executable version) in another program with no Visual Basic installed, it doesn't work; I have the "ActiveX component can't create object" error. One friend told me the problem is with the Common Dialog option, because apparently, this works just with Visual Basic already installed. So, he suggested me to use "Shell ("explorer.exe C:\")" With this I'm able to open a window but I don't know how to get the file name. I need something like before ".Filename".

Does anyone know how to get the file name for this case, withouth the Common Dialog option???

see this attachment :

Open File Without CommonDialog.zip

Hope this helps..

Hey Jx_man!!
Thanks for the reply but I can not open the file. THere is an error saying: the compressed folder is invalid or corrupted.
Plese, help!
THANKSSSSSSSSSSSSSSSS

The point is that when I'm trying to open this program (executable version) in another program with no Visual Basic installed, it doesn't work; I have the "ActiveX component can't create object" error.

each and every error in visual basic 6 compilation has a distinct cause/meaning for it.
the above error means "your application is trying to load an activex component that is not registered in the target machine (where vb6 is not installed) or it doesn't exist at all. in this case you can try one of the following remedies to get a perfect solution without changing a single bit of your code.

1. to open the common dialog box vb6 ships with an .ocx file named "comdlg32.ocx". it resides in your os' system directory. if u r using win9.x the sys dir is "system" or if u use nt based windows such as winxp your sys dir is "system32". navigate to that folder and there u will find a .ocx file named "comdlg32.ocx".
copy that file and install it into the target mahine where vb6 is not installed by just copy-paste it into its system dir.
then go to start->run and pass the following command to register the component :-
regsvr32 comdlg32.ocx
hit enter. you will notice a confirmation message. after this just go and run your application. you will never face any nasty error message.

OR,
'''''''''''THE SIMPLEST & MOST RECOMMENDED SOLUTION''''''''''''''''''''
2. to get rid of the above complication just build a setup package for your application (like every software has when you install them by double clicking the file "setup.exe"). you can access the setup building facility for vb6 applications from start->program->microsoft visual studio 6->microsoft visual studio 6.0 tools->package & deployment wizard.
if uo don't know how to create a setup script for your application visit this thread :-

Problem in running application on another computer

scroll down and go to post #8.

hope u'll get your answer there.

regards
Shouvik

Hi Shouvik!!
I already did both of the options, and still doesn't work. That's why now I'm trying to modify the code.
Maybe I'm doing something wrong. Any clue?
Thanks!

i post again :

Open File Without CommonDialog.zip

First you must add reference "Windows Scripting Runtime"
then add this code :
Dim FS As New FileSystemObject
Text1.AddItem FS.GetFileName("C:\test.txt")

'output
'Text1.text = test.txt

commented: better reply to a more recent thread. -3

Hi, everyone!
I'm kind of in a hurry. I need to know for tomorrow how can I open a file and get the file name.

This was posted on March 6th, 2008!!!!!

Stop resurrecting this zombie for no reason! Better yet, go ahead and try! Mwahahaaaaa!!! :icon_twisted:

commented: Thankyou +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.