auto create a file
i have a time card in excel that i'd like to automeate a bit more. right now I have a button on the form to save to a specific file, and it names the new time card by name, date and job #. something like "brianh10/14hilton". people have been asking for copies, and it's tough for me to modify the code for the button to save to their correct path. right now mine saves to something like /mydoc's/time/billing/. Is it possible to code the button so that , if the file doesn't exist, the code can create the correct path. code is as follows: Sub Save_As_FileName() Usr = Range("i5").Value Dte = Format(Range("l1").Value, "mmddyy") Pth = "C:\Documents and Settings\brianh\My Documents\otherjobs\Hay Hill\Time\" ActiveWorkbook.SaveAs Filename:=Pth & Usr & Dte & ".xls", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False End Sub -- -Brian-H- ------------------------------------------------------------------------ -Brian-H-'s Profile: http://www.excelforum.com/member.php...fo&userid=5665 View this thread: http://www.excelforum.com/showthread...hreadid=475245 |
All times are GMT +1. The time now is 04:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com