VBA 7.1中没有Application.SetOption方法 [英] No Application.SetOption method in VBA 7.1

查看:228
本文介绍了VBA 7.1中没有Application.SetOption方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读一些有关VBA中错误处理的Microsoft文档,他们建议将此代码包含在启动例程中以设置适当的错误处理级别:

I've been reading some Microsoft documentation about error handling in VBA and they recommend to include this code in your startup routines to set the appropriate error handling level:

Sub SafeStart()
  Application.SetOption "Error Trapping", 1
End Sub

这基本上会在工具>选项中更改此设置:

This basically changes this setting inside Tools > Options:

我手动更改了设置,效果很好。但是,由于VBA引发错误对象不支持此属性或方法,因此我无法通过代码进行更改。知道如何在VBA中设置此选项还是为什么会引发此错误?

I changed the setting manually and it works great. However I haven't been able to change it through code since VBA throws the error "Object doesn't support this property or method". Any idea how to set this option in VBA or why it's throwing this error?

谢谢

https://msdn.microsoft.com/en-us/ library / Ee358847(v = office.12).aspx

推荐答案

Application.SetOption Application.GetOption 在Excel中不可用,它们仅在Access中可用。 (您链接到的MSDN文章包括 适用于: Microsoft Office Access 2007 。)

Application.SetOption and Application.GetOption are not available in Excel, they're only available in Access. (The MSDN article you linked to includes "Applies to: Microsoft Office Access 2007".)

p.s。关于您的问题的评论,我只是确认在Access 2013中这些选项仍然存在并且可以使用,因此我猜想这些评论者可能在Access和Excel之间混在一起了。

p.s. In reference to the comments on your question, I just confirmed that the options are still there and operational in Access 2013 so I'm guessing those commenters might have been getting mixed up between Access and Excel.

这篇关于VBA 7.1中没有Application.SetOption方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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