Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
chijanzen,
it makes a new workbook, but just calls it workbook 2. it inserts the sheet, but does not save the workbook. it still says error 400. "chijanzen" wrote: steve: i want the new workbook saved in the same directory as the original workbook. fname = ThisWorkbook.Path & "\" & Date & ".xls" Set wbk = Workbooks.Add ThisWorkbook.Worksheets("Sheet1").Copy _ After:=wbk.Worksheets("Sheet1") wbk.SaveAs fname -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "steve" wrote: thanks for the reply chijanzen, i got an error 400. if this helps, i want the new workbook saved in the same directory as the original workbook. this way, you don't need to find a folder with the same name. please let me knwo if you don't understand what i mean Thanks, steve "chijanzen" wrote: steve: try it, Sub test() rpath = "P:\Projects\Jobs\" rname = Split(ThisWorkbook.Name, ".") fpath = rpath & rname(0) fname = fpath & "\" & Date & ".xls" If Dir(fpath, vbDirectory) = "" Then MkDir fpath End If Set wbk = Workbooks.Add ThisWorkbook.Worksheets("Sheet1").Copy _ After:=wbk.Worksheets("Sheet1") wbk.SaveAs fname End Sub -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "steve" wrote: Using a button: 1) copy a sheet into a new workbook 2) save the workbook into the following directory: "P:\Projects\Jobs\.... the next folder will be the same name as the original workbook is this possible? i also want to name the new workbook with today's date. i appreciate any help thanks, steve |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
specify each sheet name when saving workbook as html | Excel Discussion (Misc queries) | |||
Saving a sheet in a workbook as .csv but not changing workbook name | Excel Programming | |||
Saving one sheet within a workbook | Excel Discussion (Misc queries) | |||
saving sheet as new workbook | Excel Programming | |||
Saving only 1 sheet of a workbook | Excel Programming |