本文介绍了如何阻止/禁用从Excel 2007功能区刷新全部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经给用户一个按钮来填充来自sql oledb连接的数据。这样做可以控制用户何时从查询表中填充数据。我的问题是,我无法阻止用户按功能区中的全部刷新按钮。



在Public Sub Workbook_Open()中尝试以下代码
'

 ' - 关闭从功能区刷新功能
对于J = 1到ActiveWorkbook.Connections.Count

使用ActiveWorkbook.Connections(J).OLEDBConnection
.BackgroundQuery = False
.RefreshOnFileOpen = False
结束

'MsgBox ActiveWorkbook。连接(J).Name
下一步J

它不工作。 全部刷新仍然处于活动状态,并填充所有工作表。



请让我知道如何在用户按下该按钮时阻止功能区全部刷新或不刷新方式。



谢谢。

解决方案

我认为您唯一的选择可能是尝试并禁用全部刷新按钮我从来没有做过这样的事情



似乎显示了一种方法。

有一些有用的信息。



祝你好运!


I have given a button to the user to populate the data from sql oledb connections. That does the job so I can control when user should populate the data from query tables. My problem is, I have no way of blocking user pressing ‘Refresh All ‘ button from the ribbon.

Tried the following code in Public Sub Workbook_Open() '

        '-- Turn off the Refresh Capability from Ribbon
        For J = 1 To ActiveWorkbook.Connections.Count

           With ActiveWorkbook.Connections(J).OLEDBConnection
             .BackgroundQuery = False
             .RefreshOnFileOpen = False
           End With

          'MsgBox ActiveWorkbook.Connections(J).Name
        Next J

It doesn’t work. 'Refresh All' is still active and populates all worksheets.

Please let me know how to block ‘Refresh All’ from the ribbon or a way Not Refresh, when user presses that button.

Thanks.

解决方案

I think your only option may be to try and disable the Refresh All button, but I've never done anything like that.

This thread seemed to show a way to do it.
This site by Ron de Bruin has a lot of helpful information.
And this SO question has some helpful information.

Good luck!

这篇关于如何阻止/禁用从Excel 2007功能区刷新全部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 23:51