Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Create folder if it does not exists

What coding can I use or what ways can I use so that each workbooks path is
unique, meaning that not one workbook path is the same e.g.
C:\220210\220210.xls, C:\220211\220211.xls...

Thanks
Bob
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Create folder if it does not exists

myNum = 220110

Do
fFound = fileexists("C:\220210\" & myNum & ".xls"
if fFiund Then myNum = myNum + 1
Loop Until Not fFound


Function FileExists(sFilename As String) As Boolean
FileExists = Dir(sFilename) < ""
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Bob" wrote in message
...
What coding can I use or what ways can I use so that each workbooks path

is
unique, meaning that not one workbook path is the same e.g.
C:\220210\220210.xls, C:\220211\220211.xls...

Thanks
Bob



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Create folder if it does not exists

Try:

Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal
lpPath As String) As Long

MakeSureDirectoryPathExists "c:\abc\def\ghi\jkl\"

NOTE: Path must end with \

"Bob" wrote:

What coding can I use or what ways can I use so that each workbooks path is
unique, meaning that not one workbook path is the same e.g.
C:\220210\220210.xls, C:\220211\220211.xls...

Thanks
Bob

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Create folder if it does not exists

Here is code I've been using to check if exist and create folder if not

Dim FsO As Object
Dim FolD As String

FolD = "your\folder\path\goes\here"
Set FsO = CreateObject("Scripting.FileSystemObject")
If Not FsO.FolderExists(FolD) Then FsO.CreateFolder (FolD)




"Bob" wrote in message
...
What coding can I use or what ways can I use so that each workbooks path

is
unique, meaning that not one workbook path is the same e.g.
C:\220210\220210.xls, C:\220211\220211.xls...

Thanks
Bob



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check if a file exists in an ftp folder LL Cool A Excel Discussion (Misc queries) 3 May 16th 06 09:22 PM
Test if folder exists, create if it doesn't? 43fan Excel Programming 1 March 1st 04 04:31 PM
Test if a folder exists, create if it doesn't? 43fan Excel Programming 3 March 1st 04 02:59 PM
Test if a folder exists Jeff Marshall Excel Programming 6 September 30th 03 05:21 PM
Checking to see if Folder exists Dan[_25_] Excel Programming 2 September 24th 03 02:42 AM


All times are GMT +1. The time now is 09:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"