捕获整个公司的电子表格使用情况
我们有很多正在使用的定制电子表格解决方案,我们需要一些编程方式来跟踪它们。 显然,由于它们是电子表格,人们可以在本地保存它们、重命名它们等,因此我们需要一个可以解决这一问题的解决方案。
一些想法是:
- 在电子表格打开时,处理 OnOpen 事件并向数据库写入一条消息以跟踪
问题,这是我们存储数据库详细信息的位置。 如果数据库出现故障,我们不希望电子表格崩溃,等等,
是否有人想出一个好的电子表格库存管理解决方案来处理上述所有问题。
We have a lot of customized spreadsheet solutions that are being used and we want some programmatic way of keeping track of them. Obviously since they are spreadsheets, people can save them locally, rename them, etc so we need a solution that can account for that.
Some ideas are:
- On spreadsheet open, handle the OnOpen event and write a message to a database for tracking
the issues with this are where do we store database details. If the database is down, we dont want the spreadsheet to crash, etc
has anyone come up with a good spreadsheet inventory management solution that handles all the issues above.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我不明白您在这里试图解决的问题:您不需要电子表格使用情况记录作为最终结果,某些东西正在造成痛苦,这就是您设计的尝试修复它的方法。
如果您需要非常可靠地记录所有电子表格的使用情况,那么我认为这行不通。 如果您需要大部分可靠的日志记录,那么只需使用数据库即可,而不必担心数据库出现(罕见)故障的情况。
On Error Resume Next
应足以确保电子表格在该事件中继续。也就是说,我更倾向于采用基于 Web 的解决方案:这样您就不必参与确保每个人都有必要的数据库驱动程序、工作连接字符串和其他可怕的事情。
一些更尴尬的问题让我认为您可能需要另一种方法:
您将如何部署对日志记录解决方案的更改?
您的用户可以控制他们的宏安全级别吗? 或者编写和编辑宏的能力? 他们是否可以(无意或以其他方式)禁用日志记录?
用户可以离线操作吗? 然后会发生什么?
I don't understand the problem you're trying to solve here: you don't need spreadsheet usage logging as an end-result, something is causing pain and this is what you've devised to try to fix it.
If you need seriously reliable logging of all spreadsheet usage, then I don't think this is going to work. If you need mostly reliable logging, then just use a database and don't worry about the (rare) occasions that the database is down.
On Error Resume Next
should be enough to ensure the spreadsheet continues in that event.That said, I'd be more inclined to go for a web-based solution: that way you don't have to get involved with ensuring everyone has the necessary database drivers, working connection strings and other horridness.
Some more awkward questions that are making me think that you may need another approach:
How are you going to deploy changes to your logging solution?
Do your users have control over their macro security level? Or the ability to write and edit macros? Could they therefore (innocently or otherwise) disable logging?
Can the users operate offline? What happens then?
让 Excel 电子表格向 Web 服务器发出请求。
将 msinet.ocx 添加到工具箱并使用 Inet 控件创建一个窗体。 通过右键单击工具箱区域中的某处来添加 ocx。
然后,您可以将 Inet 控件的位置设置在您可以处理电子表格打开情况的位置。
Have the excel spreadsheet make a request out to a web server.
Add msinet.ocx to your toolbox and create a form with the Inet control. Add the ocx by right clicking somewhere in the toolbox area.
Then you can set the location of the Inet control somewhere you can handle that the spreadsheet was opened.
尽管您可能需要在短期内进行日志记录,但长期的解决方案应该是控制您的电子表格。 您应该收集电子表格的“最终”副本,并将它们移动到文件共享,在那里它们都将受到保护 - 用户将能够更改其中的数据,但无法更改公式。
如果您需要一个更受控制的协作解决方案,那么您应该考虑使用 SharePoint,可能是带有 Excel Services 的 MOSS 版本。
您可能还需要探索电子表格的使用方式。 也许他们正在被使用,而不是有人编写程序,在某些情况下,可能是时候这样做了。
最后,您不想跟踪电子表格的使用情况 - 您不在乎是否有人创建电子表格来跟踪他们孩子的足球队得分。 这是您感兴趣的特定电子表格。日志记录可能会帮助您一开始就找到它,但它能帮助您的也仅此而已。
Although you may need logging in the short term, the long term solution should be to bring your spreadsheets under control. You should gather the "definitive" copy of the spreadsheets, and move them to a file share, where they will all be protected - users will be able to change the data in them, but will be unable to change the formulas.
If you need a more controlled collaboration solution, then you should look into using SharePoint, possibly the MOSS version which has Excel Services on it.
You might also need to explore how the spreadsheets are being used. Perhaps they are being used instead of someone writing a program, and in some cases, it may be time to do that.
Lastly, you don't want to track spreadsheet usage - you don't care if someone creates a spreadsheet to track their kid's soccer team scores. It's particular spreadsheets you're interested in. The logging may help you track that down to start with, but that's all it can help you with.
我喜欢迄今为止提出的建议以及您所写的内容。 我个人喜欢让事情变得简单,所以这是我的拙见。 听起来您可能需要管理很多模板,而使用 Excel 时事情会很快变得混乱,并且很难知道公式没有被篡改。 考虑到这一点,我会忘记任何数据库更改管理解决方案,而是:
--> 尝试将其尽可能保持打开状态,以便可以在需要的地方进行自定义,但由您自行决定。
您还可以考虑设置一个版本控制存储库来管理对此文件夹结构的更改。 使用像 tortoiseSVN 这样的简单界面来研究版本控制,这样您就可以跟踪所做的更改以及时间。 标准共享驱动器备份是一个救星,但我仍然会补充版本控制系统(只是让事情变得更容易一些)。 这里有几个链接可以帮助您开始,您可以在本地尝试 subversion 并看看您的想法:
在 Windows 上设置 Subversion 的说明
Tortoise 客户端与 Subversion 交互
另请注意,如果您选择为电子表格实现某种数据库连接以在数据库服务器上执行日志记录,正如已经指出的那样,您可以使用“下一步错误恢复”。 您可以执行以下操作:
您可以选择使用 if 语句来处理错误,例如:
以下链接可查找用于以类似方式捕获的其他错误代码:
VBA 中的错误捕获
I like the suggestions being made so far and what you wrote. I personally like to keep things simple so here's my humble suggestion. It sounds like you have a lot of templates you may be managing and with excel things get messy quick and it's hard to know that formulas are not being tampered with. With that in mind I'd forget any database change management solution, instead:
--> Try to leave it as open as you can so they can be customized where they need be but at your discretion
You may also consider setting up a version control repository that manages the changes to this folder structure. Look into version control with a simple interface like tortoiseSVN so you can track what changes were made and when. The standard share drive back ups are a life saver but I'd still supplement with a version control system (just makes things a little easier). Here's a couple of links to help you get started, you can try subversion locally and see what you think:
Instructions to setup Subversion on Windows
Tortoise Client to interact with Subversion
Also note, IF you chose to implement some kind of database connection for a spreadsheet to perform logging on a database server as has already been noted you can use "on error resume next". Here's what you can do:
You can choose to handle the error then with an if statement such as:
Here's a link to look up additional error codes for trapping in similar fashion:
Error Trapping in VBA
你的想法很好。 数据库可用性通常高于用户笔记本电脑的可用性。 VBA 中有一种原始错误(异常)处理,因此他们不一定会看到奇怪的错误消息。
是的,你有损失。 当用户不在您的网络上时,对离线保存的工作表的任何使用都会从数据库中丢失。 但我认为没有 100% 万无一失的解决方案。
尝试搜索金融时报的文章,例如“Excel - 一种过于临时且容易出错的工具”。 甚至标题也说明了一切。
Your idea is good. Database availability is usually higher than the availability of the users' laptop. And there is a kind of primitive error (exception) handling in VBA, so they won't necessarily see freaking error messages.
Yes, you have a loss. Any uses of the sheet saved offline when the user is not on your network - will be missing from the database. But I don't think that there's a 100% foolproof solution for this.
Try to search for a Financial Times article like "Excel - a tool that is too ad hoc and open for errors". Even the title says it all.
写入数据库,如果写入失败,捕获错误并向某人发送电子邮件,以便在数据库备份时可以手动增加计数。
write to the db, if the write fails, catch the error and send an e-mail to someone that can manually increment the count when the database is back up.
我执行与此非常类似的操作来检查 Excel 应用程序的当前版本。 您可以轻松地使用相同的代码向将记录“点击”的服务器发出 Web 请求。 这是我的代码:
在 ThisWorkbook 中:
其他地方(在名为 Updater 的模块中)
如您所见,错误处理已到位,以确保如果 URL 不可用,应用程序不会崩溃,它只是在状态栏中向用户写入一条消息。
请注意,如果您不想设置执行此操作的 Web 服务,您可以尝试将电子表格写入数据库 - 您仍然可以重复使用大量此类代码,但不会那么多。
I do something very similar to this to check the current version of the Excel application. You could just as easily use this same code to make a web-request to a server that will log 'hits'. Here's my code:
In ThisWorkbook:
Elsewhere (in a module called Updater)
As you can see, error handling is in place to make sure that if the URL is unavailable, the app doesn't crash, it just writes a message to the user in the status bar.
Note that if you don't want to set up a web service that does this, you could try to have the spreadsheet write to a database - you could still re-use a lot of this code, but not as much of it.
您可以使用多种文件完整性监控解决方案中的任何一种来执行基于文件的方法。 Samhain 是一个免费的开源示例。 这将允许您的员工不受干扰地访问他们的电子表格,但会在发现新电子表格或他们的时间戳或哈希值发生变化时报告。 一旦开发人员重新连接到网络,它还会检测开发人员离线时(例如在笔记本电脑上)所做的更改。
You could do a file-based approach with any of several file integrity monitoring solutions. Samhain is one free open source example. That would allow your employees to access their spreadsheets without interference, but would report when new spreadsheets are discovered or when their timestamps or hash values change. It would also detect changes made while the developer was off-line (on their laptops, for example) once they've reconnected to the network.