强制另存为,MS Excel VBA [英] Force Save As, MS Excel VBA

查看:272
本文介绍了强制另存为,MS Excel VBA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MS Office产品中与VBA有点新奇。我一直在搜索一些代码,强制用户将另存为一个.xls文件用作模板(但它不是实际的模板文件类型)



基本上,我有这样的:


  1. 用户打开.xls,将一些数据输入一些字段,然后将文件 - >另存为他们自己的位置

  2. 有时用户点击保存,因此覆盖了我不想发生的.xls。

我一直在研究一些想法,但我不知道如何最好地实现它,我认为用户首次打开.xls以保存到新位置时的提示是最好的方法,但是如果他们已经将文件保存到新的位置并决定编辑新的位置,我希望他们能够在这一点上保存,因为现在它是自己的文件,而不是原始文件。



如果有人可以指出我的方向或找到我的逻辑缺陷,我很乐意听到。



谢谢,
Mike

解决方案


我用作模板(但它不是一个实际的模板文件类型)


最简单的方法是使用保存文件只读推荐设置为true。查看快照





即使用户尝试执行保存,Excel也会自动提示输入另存为





HTH


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

解决方案

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

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

HTH

这篇关于强制另存为,MS Excel VBA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆