1.

Solve : VB6 File Browser?

Answer»

Hi im in the process of programming my DTR or payroll system..
I dn't know how to create file browser to import my txt files.. I just want the folder directory and txt file NAME...
As I read from other thread they suggest to use OPen dialog controls..
But when I ctrl J no such methods or class...

Can anyone give some hint? Do I have to change any settings in VB6?i usuallly use this API to do it:

Code: [Select]Public Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
ok i will try that one..
You use ms access 2003 then vb6?Quote from: KennMobelhaus on March 26, 2009, 09:47:16 PM

You use ms access 2003 then vb6?

i dont understand

but if you are asking about if the api will work on vb6 and will it also work on vba(access2003), then the answer is yes.
if you are asking me do i learn access first, then vb6, then the answer is again yes.VBA(msaccess03) that wats i mean heheh sorry for that....SO... i can use listbox or combo box to FIND the directory.. LIKE c:\data\data.txt
In short I want to use this: c:\data\data.txt as an input to my txtbox to import that text file...
If you dnt get wat i mean just tell me...the above win32 api is to show the windows open dialog.
example: open notepad, then press CTRL-O, it popup the open dialog window <--- vb6 will open this kind of window
is this what you want??

or are you looking to populate a listbox with the contents of data.txt???I would like to obtain the path and place as a value in a txtbox in order to import it..

example: c:\data\data.txt <----- this path by clicking onlyThanks for your time... I find it already in access library using Application.FileDialog(msoFileDialogFilePicker).


I appreaciate your time... thanks a LOT...Option Compare Database

Private Sub Command0_Click()

Dim fd As FileDialog

Set fd = Application.FileDialog(msoFileDialogFilePicker)

Dim vrtSelectedItem As Variant


With fd

.Filters.clear
.Filters.Add "All files", "*.*"
.Filters.Add "Images", "*.gif; *.jpg; *.jpeg", 1
If .Show = -1 Then

For Each vrtSelectedItem In .SelectedItems

MsgBox "Path name: " & vrtSelectedItem

Next vrtSelectedItem
Else
End If
End With

Set fd = Nothing


End Sub


Thats the code and I check some references... like Microsoft Office 11.0 Object Librarythat's great. glad to see it working now.

and sharing your code here is good, you'll never know if someone else with the same problem might need it in the future, and your code have provide some guidance for them.

but i have a question:
will the program work for computer without ms.office installed??
or if you have to pack it with the setup file, is it going to make the size bigger?i think its not so big... maybe a bit


Discussion

No Comment Found