LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default creating a directory if one doesn't already exist

I am using excel 2003. In my workbook the user can enter the directory they
want to use for saving a file. They enter the path in cell B200. I want to
create the entered directory if it doesn't already exist. I am using this
code and it works if the directory doesn't exist, but if it already exists,
the program shuts down. I would appreciate any help. Strappend and str3
will be combined for the file name.

Dim strappend As String
Dim strpath As String
Dim str3 As String

strappend = ActiveSheet.Range("j8").Value
strpath = ActiveSheet.Range("b200").Value
str3 = ActiveSheet.Range("c8").Value

If Dir(strpath) = "" Then MkDir strpath

fsavename = strpath & strappend & str3 & ".xls"
 
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
Windows Message when Directory Already Exist Maperalia Excel Programming 2 January 6th 09 05:59 AM
Copy Worksheet to a new Workbook creating if it doesn't exist and add more Worksheets if it does exist [email protected] Excel Programming 4 June 18th 06 06:08 PM
Save to directory and create if not exist Rob Excel Programming 8 January 29th 05 05:39 PM
Creating a macro that lists directory names within a directory.... Andy Excel Programming 4 November 28th 04 06:13 AM
How to check if a folder/directory exist using VBA wellie Excel Programming 1 March 1st 04 02:24 AM


All times are GMT +1. The time now is 08:42 AM.

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

About Us

"It's about Microsoft Excel"