![]() |
Saving a workbook with a variable name
I am trying to save a workbook in the same directory as the workbook am working from. Also, I may exceute this macro several times while m workbook is open, so I need to figure a way to vary the "Book1" valu each time the macro is executed. What I so far... Workbooks.Add Windows("tourney.xls").Activate Range("A1:C3").Select Selection.Copy Windows("Book1").Activate Range("A1").Select ActiveSheet.Paste Range("A5").Select Application.CutCopyMode = False ActiveWorkbook.SaveAs Filename:=Range("c1"), _ FileFormat:= _ xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _ , CreateBackup:=False This is saving the new workbook in the "My Documents" directory. Ho can I get it to save in the same directory as where the workbook I a working from is contained? Also how can I vary the "Book1" value so i I execute this macro several times while my workbook is open, I'll b able to find the latest Book so it will be named correctly -- mwc091 ----------------------------------------------------------------------- mwc0914's Profile: http://www.excelforum.com/member.php...fo&userid=2413 View this thread: http://www.excelforum.com/showthread.php?threadid=39022 |
Saving a workbook with a variable name
Can I build a path name using the CurDir command and concatinating tha with the value in the cell that represents the file name I want to sav the workbook as? Then assign that full path name to a variable an reference the variable in the Filename parameter -- mwc091 ----------------------------------------------------------------------- mwc0914's Profile: http://www.excelforum.com/member.php...fo&userid=2413 View this thread: http://www.excelforum.com/showthread.php?threadid=39022 |
Saving a workbook with a variable name
Sure
-- Regards, Tom Ogilvy "mwc0914" wrote in message ... Can I build a path name using the CurDir command and concatinating that with the value in the cell that represents the file name I want to save the workbook as? Then assign that full path name to a variable and reference the variable in the Filename parameter? -- mwc0914 ------------------------------------------------------------------------ mwc0914's Profile: http://www.excelforum.com/member.php...o&userid=24130 View this thread: http://www.excelforum.com/showthread...hreadid=390225 |
All times are GMT +1. The time now is 12:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com