在Excel中以编程方式隐藏活动工作簿 [英] Hiding active workbook programmatically in Excel

查看:119
本文介绍了在Excel中以编程方式隐藏活动工作簿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个基于工作簿的VBA项目上工作。该代码打开一个新的工作簿,并调用外部API,该API可以将多个数据下载并插入到这个新工作簿的多个工作表中。我禁用屏幕更新( Application.Screenupdating = False ),所以最初屏幕保持专注于原始工作簿,而API在后台在其他工作簿上下载数据。但是,一旦API插入数据,屏幕就会切换到新的工作簿。如何防止这种情况发生?谢谢!

解决方案

您需要保存并关闭目标工作簿,或者在屏幕更新重新启动之前选择原始工作簿。 p>

I'm working on a VBA project based in a workbook. The code opens a new workbook and calls an external API which downloads and inserts a bunch of data in multiple worksheets of this new workbook. I deactivated Screen Updating (Application.Screenupdating = False) so initially the screen stays focused on the original workbook while the API downloads data on the other workbook in the background. However, the screen switches to the new workbook once the API inserts data. How can I prevent this from happening? Thanks!

解决方案

You either need to save and close the target workbook, or select the original workbook before screenupdating is turned back on.

这篇关于在Excel中以编程方式隐藏活动工作簿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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