如何在excel的不同工作簿中执行函数 [英] How do I execute a function in a different workbook of excel
问题描述
实际上我有2个(已经加载的)Excel-Workbooks。
我想在Workbook_1中执行一个函数(并获得它的返回值),但是该函数属于Workbook_2。
函数本身工作正常但我不知道访问它。
通常我不使用Excel-VBS但现在我有这个问题 - 用VB.Net我知道我要做什么...但是VBS ...... :(
我尝试过的事情:
试图找到谷歌的东西 - 但没有成功... :(
我希望,任何人都可以指导我正确的方式......
Actually I have 2 (allready loaded) Excel-Workbooks.
I want to execute a function (and get it's returning value) in Workbook_1, but the Function belongs to Workbook_2.
The Function itself is working properly but I don't know to access it.
Normally I don't work with Excel-VBS but now I have this problem - with VB.Net I know what I have to do ... but VBS ... :(
What I have tried:
Tried to find something with Google - but no Success ... :(
I hope, anyone can guide me the right way ...
推荐答案
通过提示011111100010我发现这是我的解决方案:
By the Tip of "011111100010" I found this as my Solution :
Sub test()
arg1 = 9
arg2 = 6
arg3 = Application.Run("'Test-Mappe2.xlsm'!Modul1.Add", arg1, arg2)
End Sub
为了测试,我编写了一个名为Add的函数,它放在我的第二个工作簿(Test-Mappe2.xlsm)中的Modul1中。
此函数必须添加两个参数并将其返回。
方法测试放在我的第一个工作簿(Test-Mappe1.xlsm)中。
For testing I wrote a Function called Add which is placed in Modul1 inside my 2nd Workbook (Test-Mappe2.xlsm).
This Function has to add both Arguments and deliver it's Sum back.
The Method Test is placed in my 1st Workbook (Test-Mappe1.xlsm).
这篇关于如何在excel的不同工作簿中执行函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!