禁用警告:您将大量数据复制到剪贴板

发布于 2024-07-14 20:58:15 字数 269 浏览 7 评论 0原文

在调试用 MS Access 2007 编写的查询时(所有以前的版本中的问题也相同),我将运行查询,然后将结果复制到 Excel 中。 根据结果​​,我将批处理切换到 Access 以优化结果并返回查询的设计模式。 此时,我收到一个恼人的警告:您将大量数据复制到剪贴板上。 ...您想将这些数据保存在剪贴板上吗? 我从来没有想过这样做。

MS Office 剪贴板被禁用,因此此功能在标准 Windows 剪贴板中发生。 有没有办法禁用警告并假设“否”为默认值?

While debugging queries written in MS Access 2007 (problem was the same in all previous versions too), I'll run the query and then copy the results into Excel. Depending on results, I switch batch to Access to refine the results and go back into design mode of the query. At this point, I get an annoying warning: you copied a large amount of data onto the clipboard. ...Do you want to save this data on the clipboard? I have never wanted to do this.

The MS Office clipboard is disabled so this function is happening with the standard Windows clipboard. Is there a way to disable the warning and assume No as the default?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

尬尬 2024-07-21 20:58:15

有一个非常简单的解决方案。 仅当剪贴板上有大量内容时才会出现警告消息。 因此 - 在关闭之前确保那里只有少量的东西。

例如,在我编写的宏中,我这样做:

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
Windows("iostatZd15.1").Activate
ActiveWindow.WindowState = xlNormal
ActiveSheet.Range("A1").Copy
ActiveWindow.Close

倒数第二行(紧接在关闭之前)是一个“虚拟” - 一个简单地用非常少量的数据替换当前(大)剪贴板的命令。 有用。

There is a very easy solution to this. The warning message only happens if there is a LARGE amount of stuff on the clipboard. Therefore - make sure there is only a small amount of stuff there before you close.

For example, in a macro I wrote I do this:

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
Windows("iostatZd15.1").Activate
ActiveWindow.WindowState = xlNormal
ActiveSheet.Range("A1").Copy
ActiveWindow.Close

The second-last line (immediately before the close) is a "dummy" - a command to simply replace the current (BIG) clipboard with a very small amount of data. It works.

紫罗兰の梦幻 2024-07-21 20:58:15

我想你可能必须禁用 MS 剪贴板。 试试这个:

  1. 退出所有正在运行的程序。
  2. 单击“开始”,然后单击“运行”。 键入 regedit 并单击“确定”。
  3. 在注册表编辑器中,单击以选择以下子项(文件夹): HKey_CURRENT_USER\Software\Microsoft\Office\9.0\Common\General
  4. 在“编辑”菜单上,指向“新建”,然后单击“DWORD 值”。 选择新值 #1 后,键入 AcbControl,然后按 Enter。
  5. 在“编辑”菜单上,单击“修改”。 在“编辑 DWORD 值”对话框中,单击“基数”下的“十进制”。 在值数据框中键入 1。 单击“确定”并退出注册表编辑器。

注意:您无法通过修改注册表来仅禁用(或启用)单个 Office 程序的 Office 剪贴板。

这是 MS 知识库文章

I think you may have to disable the MS clipboard. Try this:

  1. Quit any programs that are running.
  2. Click Start, and then click Run. Type regedit and click OK.
  3. In the Registry Editor, click to select the following subkey (folder): HKey_CURRENT_USER\Software\Microsoft\Office\9.0\Common\General
  4. On the Edit menu, point to New and click DWORD Value. With New Value #1 selected, type AcbControl, and then press ENTER.
  5. On the Edit menu, click Modify. In the Edit DWORD Value dialog box, click Decimal under Base. Type 1 in the Value data box. Click OK and quit the Registry Editor.

NOTE: You cannot disable (or enable) the Office Clipboard for only a single Office program by modifying the registry.

Here's the MS KB article

心凉怎暖 2024-07-21 20:58:15

您可以设置窗体的 OnClose 事件来清除剪贴板。

将以下代码放入数据库的模块中。

Private Declare Function apiOpenClipboard Lib "User32" Alias
"OpenClipboard" (ByVal hWnd As Long) As Long

Private Declare Function apiEmptyClipboard Lib "User32" Alias
"EmptyClipboard" () As Long

Private Declare Function apiCloseClipboard Lib "User32" Alias
"CloseClipboard" () As Long

Function EmptyClipboard()
  If apiOpenClipboard(0&) <> 0 Then
    Call apiEmptyClipboard
    Call apiCloseClipboard
  End If
End Function

然后在表单的 Close 事件中使用:

EmptyClipboard

You could set the OnClose event of the form up to clear the clipboard.

Put the below code into a module in your database.

Private Declare Function apiOpenClipboard Lib "User32" Alias
"OpenClipboard" (ByVal hWnd As Long) As Long

Private Declare Function apiEmptyClipboard Lib "User32" Alias
"EmptyClipboard" () As Long

Private Declare Function apiCloseClipboard Lib "User32" Alias
"CloseClipboard" () As Long

Function EmptyClipboard()
  If apiOpenClipboard(0&) <> 0 Then
    Call apiEmptyClipboard
    Call apiCloseClipboard
  End If
End Function

Then in the Close event of your form use:

EmptyClipboard
多情出卖 2024-07-21 20:58:15

根据我的经验,只有在关闭应用程序时您才会收到此消息。 返回 Access 之前是否要关闭 Excel? 如果是这样,请不要关闭它,看看是否不再收到该消息。

在尝试产生错误的说明后进行编辑:

避免错误消息的唯一方法是在进入设计视图之前关闭通知,如下所示:

  DoCmd.SetWarnings False

并且您希望在完成编辑后将其重新打开。

但没有地方可以运行此代码,因为您只是使用 Access UI 来编辑查询。

我不太明白为什么这个警告被认为是一个问题。 也许您正在粘贴,返回设计视图,更改标准,再次运行,再次粘贴? 如果是这样,关闭 SetWarnings 可能会成功。

如果您希望它自动发生,您可以使用 Screen.ActiveDatasheet 对象来执行此操作。 您想要做的是编写一个函数:

  Public Function ChangeWarnings(bolSetting As Boolean) As Boolean
    DoCmd.Setwarnings bolSetting
  End Function

...然后当您在数据表视图中打开查询时,在“立即”窗口中键入这两行:

  Screen.ActiveDatasheet.OnActivate = "=ChangeWarnings(False)"
  Screen.ActiveDatasheet.OnDeactivate = "=ChangeWarnings(True)"

您当然也可以编写为您设置此功能的代码。

需要注意的是,当打开或关闭另一个对象时,它不会“粘住”Screen.ActiveDatasheet 对象。 它仅适用于您分配事件操作时处于活动状态的数据表。

In my experience, you only get this message when you close an application. Are you closing Excel before returning to Access? If so, don't close it and see if you no longer get the message.

EDIT after trying instructions for producing the error:

The only way to avoid the error message is to turn off notifications before entering design view, as in:

  DoCmd.SetWarnings False

And you'd want to turn it back on after you are done with your editing.

But there's no place to run this code, since you're just using the Access UI to edit a query.

I don't quite understand why this warning is considered a problem. Maybe you're pasting, going back to design view, changing criteria, running again, pasting again? If so, turning SetWarnings off might do the trick.

If you wanted it to happen automatically, you could conceivably use the Screen.ActiveDatasheet object to do this. What you'd want to do is write a function:

  Public Function ChangeWarnings(bolSetting As Boolean) As Boolean
    DoCmd.Setwarnings bolSetting
  End Function

...then when you open your query in datasheet view, in the Immediate window, type these two lines:

  Screen.ActiveDatasheet.OnActivate = "=ChangeWarnings(False)"
  Screen.ActiveDatasheet.OnDeactivate = "=ChangeWarnings(True)"

You could also certainly write code that sets this up for you.

One note -- it doesn't "stick" for the Screen.ActiveDatasheet object when opening or closing a different one. It applies only to the Datasheet that is active when you assign the event actions.

仅此而已 2024-07-21 20:58:15

对于 Excel:

Fexcel = New Microsoft.Office.Interop.Excel.Application
Fexcel.DisplayAlerts = False

对 Access 执行相同操作

For Excel:

Fexcel = New Microsoft.Office.Interop.Excel.Application
Fexcel.DisplayAlerts = False

Do same for Access

漫漫岁月 2024-07-21 20:58:15

应用程序.CutCopyMode = False

Application.CutCopyMode = False

弥繁 2024-07-21 20:58:15

我一直遇到这个问题。 必须这样做似乎很愚蠢,但以下解决方案可以杀死它。

' Copy something small into the clipboard
Range("A1").Copy

' Turn off CutCopyMode i.e., the "crawling ants"
' Application.CutCopyMode = False solves a lot of problems, I do it as a precaution after I copy anything
Application.CutCopyMode = False

CutCopyMode = FALSE 不会关闭所有剪贴板复制(如另一张海报所述)

I run into this problem all the time. It seems silly to have to do this, but the following solution kills it dead.

' Copy something small into the clipboard
Range("A1").Copy

' Turn off CutCopyMode i.e., the "crawling ants"
' Application.CutCopyMode = False solves a lot of problems, I do it as a precaution after I copy anything
Application.CutCopyMode = False

CutCopyMode = FALSE does not turn off the all clipboard copying (as stated by another poster)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文