Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Getting system directories | Excel Programming | |||
sub directories again | Excel Programming | |||
sub directories again | Excel Programming | |||
sub directories | Excel Programming | |||
Directories | Excel Programming |