1. 电脑A的EXCEL文件放到共享文件夹;
2. 电脑B的EXCEL文件相应Sheet的Worksheet_Change事件中判断A1的值;
3. 后台打开电脑A的EXCEL文件,并执行其制定过程。
4. Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(1, 1) <> 1 Then Exit Sub
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim xlmodule As Object 'VBComponent
Set xlApp = CreateObject('Excel.Application') '创建EXCEL对象
Set xlBook = xlApp.Workbooks.Open('E:\1.xls') '创建EXCEL工件簿文件
Set xlmodule = xlBook.VBProject.VBComponents.Add(1)
xlApp.Visible = False'设置EXCEL对象可见(或不可见)
Set xlSheet = xlBook.Worksheets('Sheet1') '设置活动工作表
With xlSheet
'执行宏
xlApp.Run 'ddddd' '格式修改代吗
End With
xlBook.Close (True) '关闭工作簿(保存)
xlApp.Quit '结束EXCEL对象
Set xlApp = Nothing '释放xlApp对象
End Sub
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。