Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default saving/creating a directory

sPath$ = "c:\Temp"
If Dir(sPath, vbDirectory) = "" Then
MkDir (sPath)
End I

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default saving/creating a directory

Note: from Tom Ogilvy

sPath = "C:\Data"
if Dir(sPath,vbDirectory) < "" then
if getAttr(sPath) = vbDirectory then
msgbox sPath & " exists"
end if
end if

You need to do the getAttr because Dir checks for both a file and a
directory when you do Dir(sPath,vbDirectory), so it could be fooled by a
file named C:\data with no extension.



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"mudraker " wrote in message ...
sPath$ = "c:\Temp"
If Dir(sPath, vbDirectory) = "" Then
MkDir (sPath)
End If


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default saving/creating a directory

Hi,

I have a macro which automatically saves the workbook to the path specified
in one of the cells - defined as "fname" within the macro.

If this path does not exist on someones drive is there a way of creating the
required folders?

TIA

Matt


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
set default directory for saving files Vibeke Excel Discussion (Misc queries) 5 August 23rd 07 12:52 PM
How to change options for saving when old directory(network) gone Mel Ackerman Setting up and Configuration of Excel 3 August 10th 06 10:10 PM
Saving to root directory ChrisP Excel Discussion (Misc queries) 2 July 31st 06 02:10 AM
Saving into new directory Greg B Excel Discussion (Misc queries) 2 March 2nd 05 03:58 PM
Saving to same directory Michael Beckinsale Excel Programming 1 December 12th 03 07:31 PM


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

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"