Saving template as non executable file

A

Annie

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
 
C

CodeBanger

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top