Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default making directories

I want to perform the following:

1) prompt the user for a name (input box)
2) create a directory using this name (thisworkbook.path & "\" & name)
3) save this workbook (SaveAs) in this new directory, using the name from the
input box

Thank you
Steve
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default making directories

Try this Steve

Sub Test()
Dim fs As Object
Dim Dirname As String
Dim mycell As String
mycell = Application.InputBox( _
prompt:="Enter a Dir name", Type:=2)
If Trim(mycell) < "" Then

Set fs = CreateObject("Scripting.FileSystemObject")
Dirname = ThisWorkbook.Path & "\" & Trim(mycell)
If Not fs.FolderExists(Dirname) Then
fs.CreateFolder Dirname
ThisWorkbook.SaveAs Dirname & "\" & Trim(mycell) & ".xls"
Else
MsgBox "Exist"
End If
End If
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"steve" wrote in message ...
I want to perform the following:

1) prompt the user for a name (input box)
2) create a directory using this name (thisworkbook.path & "\" & name)
3) save this workbook (SaveAs) in this new directory, using the name from the
input box

Thank you
Steve



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default making directories

Dim res as String, sName as String
res = Inputbox("Enter the new directory name")
if res = "" then exit sub
Mkdir Thisworkbook.Path & "\" & res
sName = ThisWorkbook.Name
Thisworkbook.SaveAs ThisWorkbook.Path & "\" & res & "\" _
& sName

or
Thisworkbook.SaveAs ThisWorkbook.Path & "\" & res & "\" _
& res & ".xls"

depending on what you mean by SaveAs using the name from the inputbox

--
Regards,
Tom Ogilvy


"steve" wrote in message
...
I want to perform the following:

1) prompt the user for a name (input box)
2) create a directory using this name (thisworkbook.path & "\" & name)
3) save this workbook (SaveAs) in this new directory, using the name from

the
input box

Thank you
Steve



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default making directories

Thanks guys,

exactly what i needed, as always


"Tom Ogilvy" wrote:

Dim res as String, sName as String
res = Inputbox("Enter the new directory name")
if res = "" then exit sub
Mkdir Thisworkbook.Path & "\" & res
sName = ThisWorkbook.Name
Thisworkbook.SaveAs ThisWorkbook.Path & "\" & res & "\" _
& sName

or
Thisworkbook.SaveAs ThisWorkbook.Path & "\" & res & "\" _
& res & ".xls"

depending on what you mean by SaveAs using the name from the inputbox

--
Regards,
Tom Ogilvy


"steve" wrote in message
...
I want to perform the following:

1) prompt the user for a name (input box)
2) create a directory using this name (thisworkbook.path & "\" & name)
3) save this workbook (SaveAs) in this new directory, using the name from

the
input box

Thank you
Steve




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
Getting system directories Fred Excel Programming 3 February 28th 05 11:31 PM
sub directories again Shailesh Shah[_2_] Excel Programming 5 February 9th 04 09:32 PM
sub directories again Mike[_67_] Excel Programming 2 February 7th 04 12:06 AM
sub directories Mike Excel Programming 5 February 6th 04 10:15 PM
Directories Jeff[_24_] Excel Programming 4 January 20th 04 09:26 AM


All times are GMT +1. The time now is 07:59 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"