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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BROWSEFORFILE?

Status
Not open for further replies.

12TOAST

Technical User
Joined
Sep 23, 2008
Messages
2
Location
GB
Hi is there a browse for file function? I have a script which uses the browseforfolder function but I would like to go 1 level deeper and browse the file and then copy it using vbs.

I paste my script below that browses by foder.

Thanks
{<

Dim fso
Dim path
Dim oFolder
Dim oSubFolder
Const OverwriteExisting = True

Set Sh = CreateObject("Shell.Application")
Set F = Sh.BrowseForFolder(0, "Choose the folder containing files to transfer", 0, 17)
If F Is Nothing Then WSCript.Quit
transfer = F.Items.Item.Path



Set Sh = CreateObject("Shell.Application")
Set F = Sh.BrowseForFolder(0, "Choose Target Folder", 0, 17)
If F Is Nothing Then WSCript.Quit
Path = F.Items.Item.Path

Set fso = createobject("Scripting.FileSystemObject")
Folder = transfer & "\*"

Set oFolder = fso.GetFolder(Path)
Set colSubfolders = oFolder.Subfolders

For Each oSubfolder in colSubfolders
fso.CopyFolder Folder, path & "\" & oSubFolder.Name & "\", OverwriteExisting
Next


'THIS SCRIPT WILL COPY A FOLDER CONTAINING FOLDERS AND DOCUMENTS ETC TO A SET OF SUBFOLDERS AT A DESTINATION
'BY ALLOWING YOU TO BROWSE !!TO THE FOLDERS <SOURCE & DESTINATION>
 
Many thanks I will see how I can fit this into my code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top