Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I am trying to get a macro to save my workbook. I need the macro to name the workbook from whatever is in cell A1 and have it create a folder on the hard drive with the same name and save the workbook in that folder. The folder will reside in My Documents. So, if the cell A1 is called "20456", I need the name of the newly created folder to be 20456 and the name of the workbook saved in the "20456" folder to be "20456.xls". Any help would be greatly appreciated. TIA, Yobeee |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Something like:
Option Explicit Sub testme1() Const myFolder As String = "C:\my documents\" With Worksheets("sheet1").Range("a1") On Error Resume Next MkDir myFolder & .Value On Error GoTo 0 ThisWorkbook.SaveAs Filename:=myFolder & .Value & "\" & .Value & ".xls" End With End Sub yo beee wrote: Hi all, I am trying to get a macro to save my workbook. I need the macro to name the workbook from whatever is in cell A1 and have it create a folder on the hard drive with the same name and save the workbook in that folder. The folder will reside in My Documents. So, if the cell A1 is called "20456", I need the name of the newly created folder to be 20456 and the name of the workbook saved in the "20456" folder to be "20456.xls". Any help would be greatly appreciated. TIA, Yobeee -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Create Folder Using VBA | Excel Discussion (Misc queries) | |||
Macro to create a folder and copy files | New Users to Excel | |||
Macro to create a new folder according to the month | Excel Discussion (Misc queries) | |||
Create a folder.... | Excel Programming | |||
Create Folder..... | Excel Programming |