Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to browse for a file's using VBScript

Status
Not open for further replies.

tbscmgi

MIS
Sep 17, 2003
66
0
0
US
Hi-
I'm new to VBScript.
Could someone help with some VBScript code!
I am trying to write a script so when you run it the browse window will pop-up so that the user can find the file the want. Also when the find the file the want I wnat to filter the data for error.

any help will be appreciated
Thanks
TBSCMGI
 
it sounds like you are better off thinkin about writing something in VB proper and using the built in forms and controls that are available to you.
i am not vbscript would be the easiest or best way of achieving what you want.

if you are talking about word documents or just excel documents you might find VBA would be the best bet. in vba there are built in application methods to open up save as windows etc. the VBA forum on this site is very good.

best of luck
mrmovie
 
There are several methods for what you want to do.
If you just want a file selection box to open with a file type filter do this.

Code:
FPath = FileSelectionBox("Select a TextFile.", "*.txt", FileSelectionModeOpen)

This the first step selecting the file and apply a file type filter to the selection box.
If you just need to read the contents of a document without actually opening it do this.

Code:
Set MyFile = FileSystem.GetFile(FPath)
Set MyString = MyFile.OpenAsTextStream("ForReading")

 
puck2,
from which object comes the FileSelectionBox method ?
 
puck2-
thanks for the info, but i am new to all of this. do you have sample script how this work.
any help will be appreciated
Thanks
TBSCMGI
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top