Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am writing a macro, a part of which is saving the current workbook. I dont
want the name of the file to be the same everytime... The path name should stay the same but the name of the file should be taken from a cell in the workbook (C5). How can I write this into the macro? ActiveWorkbook.SaveAs Filename:= _ "P:\***path name***\Name of the file.xls" _ , FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False Thanks for any help |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
Set the variable mypath to the correct one and change Sht to the correct worksheet and try this mypath = "C:\" Set sht = Sheets("Sheet1") ActiveWorkbook.SaveAs Filename:= _ mypath & sht.Range("C5").Value _ , FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Wombat" wrote: I am writing a macro, a part of which is saving the current workbook. I dont want the name of the file to be the same everytime... The path name should stay the same but the name of the file should be taken from a cell in the workbook (C5). How can I write this into the macro? ActiveWorkbook.SaveAs Filename:= _ "P:\***path name***\Name of the file.xls" _ , FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False Thanks for any help |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Edit the sheetname.....
Dim strPath as String Dim strFile as String strPath = ActiveWorkbook.Path strFile = Sheets("Sheetname").Range("C5").Text & ".xls" ActiveWorkbook.SaveAs Filename:= strPath & "\" & strFile, FileFormat:=xlNormal -- Jacob "Wombat" wrote: I am writing a macro, a part of which is saving the current workbook. I dont want the name of the file to be the same everytime... The path name should stay the same but the name of the file should be taken from a cell in the workbook (C5). How can I write this into the macro? ActiveWorkbook.SaveAs Filename:= _ "P:\***path name***\Name of the file.xls" _ , FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False Thanks for any help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Makro | New Users to Excel | |||
Color Changes When Saving 2007 Workbook as 97 - 2003 Workbook | Excel Discussion (Misc queries) | |||
Makro in excel | Excel Worksheet Functions | |||
If with a makro | Excel Discussion (Misc queries) | |||
Makro | Excel Discussion (Misc queries) |