Click here to Skip to main content
15,889,931 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: the formula of excel Pin
Richard MacCutchan3-Jun-20 0:29
mveRichard MacCutchan3-Jun-20 0:29 
GeneralRe: the formula of excel Pin
Richard Deeming3-Jun-20 1:11
mveRichard Deeming3-Jun-20 1:11 
GeneralRe: the formula of excel Pin
Richard MacCutchan3-Jun-20 2:10
mveRichard MacCutchan3-Jun-20 2:10 
QuestionError loading file with crystal report in Vb .net Pin
tacbanon17-Jun-18 0:55
tacbanon17-Jun-18 0:55 
AnswerRe: Error loading file with crystal report in Vb .net Pin
Richard MacCutchan17-Jun-18 1:09
mveRichard MacCutchan17-Jun-18 1:09 
QuestionInterview Pin
Member 1387329014-Jun-18 11:54
Member 1387329014-Jun-18 11:54 
AnswerRe: Interview Pin
Eddy Vluggen14-Jun-18 11:59
professionalEddy Vluggen14-Jun-18 11:59 
QuestionHow do I stop folders being merged too. Pin
glenn masters3-Jun-18 1:57
glenn masters3-Jun-18 1:57 
Hi

The script shown at the bottom creates a subfolder in "C:\Downloads" and moves files that are within it all into it after I named it .

What it is that I already have subfolders within the folder and when im running command its also merging the subfolders that I have alreay created too.

I may be wrong but believe that the line below is causing the issue but donno what to put in. I think that its tellling it for each object in the folder to merge but as mentioned I only need files merged and not the folders. They just need to be left there and do nothing with them.

Am I right and if so what do I need to prevent it from merging subfolders already created.

Any ideas?

VB
<pre>On Error Goto 0
For Each objFile In objDLFolder.Files
  objFSO.MoveFile objFile.Name, strNewFolder & "\"


The original script below

Option Explicit

Const strDLFolder = "C:\Downloads"
Dim objFSO, objWShell, objDLFolder, strNewFolder, objFile

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWShell = CreateObject("WScript.Shell")


If Not objFSO.FolderExists(strDLFolder) Then objFSO.CreateFolder(strDLFolder)
objWShell.CurrentDirectory = strDLFolder
Set objDLFolder = objFSO.GetFolder(strDLFolder)
If objDLFolder.Files.Count = 0 Then WScript.Quit

Do
  Err.Clear
  strNewFolder = InputBox("Folder Name", vbLf & "Enter the name of the folder to be created:")
  If strNewFolder = False Then WScript.Quit
  On Error Resume Next
  objFSO.CreateFolder strNewFolder
Loop While Err.Number <> 0 Or Not objFSO.FolderExists(strNewFolder)

On Error Goto 0
For Each objFile In objDLFolder.Files
  objFSO.MoveFile objFile.Name, strNewFolder & "\"
Next

objWShell.Popup "All files moved.", 0, "Done", vbInformation Or vbSystemModal Or &h00040000&

objWShell.Run "explorer.exe /select,""" & objFSO.BuildPath(strDLFolder, strNewFolder) & """"

Next


SuggestionRe: How do I stop folders being merged too. Pin
Richard MacCutchan3-Jun-18 23:56
mveRichard MacCutchan3-Jun-18 23:56 
Questionvb.net desk app using app.config file Pin
dcof1-Jun-18 11:21
dcof1-Jun-18 11:21 
AnswerRe: vb.net desk app using app.config file Pin
Dave Kreskowiak1-Jun-18 13:24
mveDave Kreskowiak1-Jun-18 13:24 
GeneralRe: vb.net desk app using app.config file Pin
dcof4-Jun-18 9:56
dcof4-Jun-18 9:56 
GeneralRe: vb.net desk app using app.config file Pin
Dave Kreskowiak4-Jun-18 11:13
mveDave Kreskowiak4-Jun-18 11:13 
GeneralRe: vb.net desk app using app.config file Pin
dcof5-Jun-18 4:21
dcof5-Jun-18 4:21 
GeneralRe: vb.net desk app using app.config file Pin
Dave Kreskowiak5-Jun-18 5:45
mveDave Kreskowiak5-Jun-18 5:45 
GeneralRe: vb.net desk app using app.config file Pin
dcof5-Jun-18 7:48
dcof5-Jun-18 7:48 
GeneralRe: vb.net desk app using app.config file Pin
Dave Kreskowiak5-Jun-18 8:11
mveDave Kreskowiak5-Jun-18 8:11 
QuestionInserting to new table in between two table in ms word from vb.net Pin
Osioghole Clifford28-May-18 13:50
Osioghole Clifford28-May-18 13:50 
QuestionLINQ: How To Make Order By Conditional? Pin
Alan Burkhart26-May-18 16:05
Alan Burkhart26-May-18 16:05 
AnswerRe: LINQ: How To Make Order By Conditional? Pin
Richard MacCutchan27-May-18 1:05
mveRichard MacCutchan27-May-18 1:05 
GeneralRe: LINQ: How To Make Order By Conditional? Pin
Alan Burkhart29-May-18 14:42
Alan Burkhart29-May-18 14:42 
AnswerRe: LINQ: How To Make Order By Conditional? Pin
Richard Deeming30-May-18 9:58
mveRichard Deeming30-May-18 9:58 
GeneralRe: LINQ: How To Make Order By Conditional? Pin
Mycroft Holmes30-May-18 14:27
professionalMycroft Holmes30-May-18 14:27 
GeneralRe: LINQ: How To Make Order By Conditional? Pin
Richard Deeming31-May-18 1:15
mveRichard Deeming31-May-18 1:15 
GeneralRe: LINQ: How To Make Order By Conditional? Pin
Alan Burkhart31-May-18 7:18
Alan Burkhart31-May-18 7:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.