Saving template as non executable file
I have designed a password protected Excel template (.xlt)
which performs various calculations. As this template is fairly large, I would like to give the user the option of saving any calculation performed using the template as a non executable document (.xls). If the document is to be saved, only three of the six worksheets are required (including the appropriate column and row settings), and certain macros only would need to be retained (which are run from buttons on the worksheet). Once the document has been saved I would then like to give the user the option of performing another calculation using the template or to quit Excel if no other workbooks are currently open (using a MsgBox or a UserForm). I can write the VBA code required to delete the appropriate worksheets and paste special the results of the formula, but I'm struggling to work out the process of saving/reopening the appropriate files. Please, please, please could anybody point me in the right direction. I would be very grateful for any suggestions and/or snippets of useful code. Many thanks. Annie |
Saving template as non executable file
Paste the following into a blank macro on a book1 and run it. It shoul save the file as "Order-(text in B4) (Current Date)" and then close th file. Dim wb As Workbook, strdate As String, sCurDir As String strdate = Format(Now, "ddd, MMM dd yyyy hh-mm") Set wb = ActiveWorkbook sCurDir = Application.DefaultFilePath ChDir Application.DefaultFilePath wb.SaveAs "Order-" & Range("B4").Text _ & " " & strdate & ".xls" wb.Saved = True wb.Clos -- CodeBange ----------------------------------------------------------------------- CodeBanger's Profile: http://www.msusenet.com/member.php?userid=191 View this thread: http://www.msusenet.com/t-49415 |
All times are GMT +1. The time now is 03:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com