Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force Save As, MS Excel VBA

Tags:

excel

vba

I'm a bit of a newby with VBA in MS Office products. I've been searching for some code that will force a user to "Save As' a .xls file I use as a template (but it's not an actual template file type)

Basically, I have this:

  1. User opens .xls, enters some data into some field and then File-->Save As to their own location
  2. Sometimes user clicks save instead, therefore overwriting the .xls which I don't want to happen.

I've been looking into some ideas, but I'm not sure how to implement it the best. I think a prompt when the user first opens the .xls to save to a new location is the best approach, but thinking forward, if they have already saved the file to a new location and decide to edit the new one, I want them to be able to 'Save' at that point because now it is their own file, not the original.

If someone can point me in the right direction or find flaws in my logic, I'd love to hear it.

Thanks, Mike

like image 917
Mike Avatar asked Dec 27 '22 01:12

Mike


1 Answers

I use as a template (but it's not an actual template file type)

The most simplest way is to save the file with Read-Only Recommended set to true. See the snapshot

enter image description here

That ways even if the user tries to do a Save, Excel will automatically prompt for a Save As

enter image description here

HTH

like image 149
Siddharth Rout Avatar answered Dec 30 '22 10:12

Siddharth Rout