Can anyone tell me how to browse a file in VB. Please let me know as soon as possible as my project is stuck because of it. Please also let me know that how we can print a file. Thanks.
Browsing the files!!!
Collapse
X
-
Tags: None
-
there you go
[CODE=vb]Dim Str1 as String
With Application.Fil eDialog(msoFile DialogFilePicke r)
.AllowMultiSele ct = True
.Filters.Clear
.Filters.Add "JPG files (*.jpg)", "*.jpg"
.Filters.Add "All Files (*.*)", "*.*"
.InitialFileNam e = Str1
.Show
If .SelectedItems. Count > 0 Then
'Do whatever you want with str1 & selectedItems.I tem(n)
'Or just save the complete file name to a string with
' dim mystring as string
' mystring = str1 & selecteditems.i tem(n)
end if
end with[/CODE]
I put the multiselect = true, but if you set it with false, the only selected item will be item(1)
Good Luck -
What do you mean exactly by "browse"? The prior response shows (I think) how to list and choose files. If you mean how to read the contents of a file, you could try hitting the index at the top of the VB forum. There are a couple of samples listed in there which show how to read a file.Originally posted by eklavyavatsCan anyone tell me how to browse a file in VB. Please let me know as soon as possible as my project is stuck because of it. Please also let me know that how we can print a file. Thanks.
By the way, what version of VB are you using?Comment
Comment