Vb.net审核excel VBA中的事件 [英] Vb.net to audit events in excel VBA

查看:209
本文介绍了Vb.net审核excel VBA中的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!



我有一个Vb.net项目,它用于安排,启动和运行excel工作簿的给定宏。 />


这是代码:

Hello There!

I've a Vb.net Project that it is used to schedule, launch, and run a given macro of excel workbooks.

Here's the code:

If File1.Text <> "" Then
                    xlApp = New Excel.Application
                    xlworkbook = xlApp.Workbooks.Open(File1.Text, Local:=True)
                    xlApp.Visible = True
                    If mymacro1 <> "" Then
                        xlApp.Run(mymacro1)
                    End If

                    If mysave1 <> "" Then
                        fname = xlworkbook.Name
                        lpath = xlworkbook.Path & "\"
                        My.Computer.FileSystem.CopyFile(lpath & fname, mysave1 & fname, True)
                    End If
                    xlworkbook.Close()
                    End If





我想知道的是,如果可以为vba中的每个动作创建一个审计/日志。



目前,我已经将这样的日志设置为excel worbook使用:



我想知道是否可能设置vb项目以读取和写入由excel宏完成的每个操作的txt / csv。







最好的问候,



FC



我尝试了什么:



目前,我已经开始了通过使用以下方式登录exbook worbook:





What I'd like to know is that if it is possible to create an audit/log for each action in vba.

Currently, i've set such log to excel worbook by using:

I'd like to know if it's possible to set the vb project to read and write to a txt/csv every action done by the excel macro.



Best Regards,

FC

What I have tried:

Currently, i've set such log to excel worbook by using:

Set mytxt = CreateObject("Scripting.FileSystemObject")
Set mylog = mytxt.createtextfile("Log_" & Now)
mylog.writeline Now & " | " & 'Action' 





但是打算创建一个按钮来启用/禁用此日志的创建,而无需将其编码到excel宏中。



But the intend is to create a button to enable/disable the creation of this log, without the need to code this into the excel macro.

推荐答案

嘿那里,



通过以下链接进行管理:



https://support.microsoft.com/en-us/kb/302814 [ ^ ]



请求帮助



祝你好运
Hey there,

Managed to do it through this link:

https://support.microsoft.com/en-us/kb/302814[^]

Tks for the help

Best regards


这篇关于Vb.net审核excel VBA中的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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