Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
I am new in VBA and i want to check for a folder and if the folder can not be find creat it. any sugestion would be appriciated. Thanks, -- Farhad Hodjat |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
try the below code
'Declare File System object Dim oFSO As Scripting.FileSystemObject 'Initialize File System object Set oFSO = New Scripting.FileSystemObject 'Check if your desired folder exists If oFSO.FolderExists("H:\Test") Then Debug.Print "yes" Else 'Create your desired folder as it does not exist oFSO.CreateFolder "H:\Test" End If Before you use the above code make sure you have referred to MicroSoft Scripting Runtime from Tools--References HTH, -- Pranav Vaidya VBA Developer PN, MH-India If you think my answer is useful, please rate this post as an ANSWER!! "Farhad" wrote: Hi, I am new in VBA and i want to check for a folder and if the folder can not be find creat it. any sugestion would be appriciated. Thanks, -- Farhad Hodjat |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If Dir("C:\HopedForFolder\nul") = "" Then MkDir "C:\HopedForFolder"
-- Jim "Farhad" wrote in message ... | Hi, | | I am new in VBA and i want to check for a folder and if the folder can not | be find creat it. any sugestion would be appriciated. | | Thanks, | -- | Farhad Hodjat |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
searching by number or code ina work book | Excel Discussion (Misc queries) | |||
Searching, matching then searching another list based on the match | Excel Discussion (Misc queries) | |||
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? | Excel Discussion (Misc queries) | |||
Need code to save file to new folder, erase from old folder | Excel Discussion (Misc queries) | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Discussion (Misc queries) |