How do I create a folder in VB if it doesn't exist?

后端 未结 12 1330
孤独总比滥情好
孤独总比滥情好 2020-12-23 11:29

I wrote myself a little downloading application so that I could easily grab a set of files from my server and put them all onto a new pc with a clean install of Windows, wi

12条回答
  •  失恋的感觉
    2020-12-23 11:58

    Since the question didn't specify .NET, this should work in VBScript or VB6.

    Dim objFSO, strFolder
    strFolder = "C:\Temp"
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    If Not objFSO.FolderExists(strFolder) Then
       objFSO.CreateFolder(strFolder)
    End If
    

提交回复
热议问题