ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I disable Save? (https://www.excelbanter.com/excel-programming/277077-re-can-i-disable-save.html)

Jake Marx

Can I disable Save?
 
Hi Patrick,

You should consider keeping your code separate from your report. That way,
you don't have to worry about the user saving the report, and no code will
reside in the report itself.

Basically, you could create an Add-In that contains all the code. In this
Add-In, you would use code like this to open your report template:

Dim wb As Workbook

Set wb = Workbooks.Add(Template:="c:\my_report.xlt")

Now you have opened the workbook and the object variable wb contains a
reference to that workbook. When you're done, you just set wb = Nothing and
allow the user to do what he/she will with the report. Since you're using a
template, the user will be prompted to save the resulting workbook to a new
location when saving. To be safe, you'll want to keep a copy of your
template, and you may want to make the template read-only and/or set NTFS
permissions on it so it is read-only. That way, a user can't inadvertently
modify the template directly.

Regards,

Jake Marx
MS MVP - Excel


"Patrick" wrote in message
...
I apologize if this has already been addressed... I could
not find it with a search.

My code starts a 3270 emulator session, navigates to a
report on the host, rips the data out, and populates a
sheet in the workbook. The user will do this daily and
there are many rows of data.

I would like to prevent the user from saving the workbook
(leaving the workbook pristine and uncluttered by daily
junk), though they should be free to SaveAs.

Secondly,
When they use SaveAs, is there a way to prevent the VBA
code from being saved along with the data on the sheets?

Many Thanks!
patrick





All times are GMT +1. The time now is 06:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com