Click here to Skip to main content
14,981,685 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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 ...
Updated 27-Aug-18 0:11am
gacar 23-Aug-18 18:23pm
You can ask to him.
Ralf Meier 28-Aug-18 13:28pm
Your Link to another Codeproject-Member wasn't useful. I know 'ppolymorphe' and if he has an answer to me he would have give it to me.
Do you have downvoted me ? ... and why ?
Ralf Meier 27-Aug-18 6:07am
To get a useful Google-Result it's allways necessary to have (or know) the right Keywords ... ;-)
So thanks for your Tip - it wasn't the Solution but it pointed me to the Solution ... :)
ZurdoDev 27-Aug-18 7:52am
True about the keywords, but the keywords I used where the same ones in your title. Just saying.
Ralf Meier 27-Aug-18 14:43pm
Thank you for downvoting my question and also my Solution.
I suppose that you (or I ???) didn't understand the sense of this forum ... would you please be so kind and help me with this question too ...?
ZurdoDev 27-Aug-18 15:15pm
I did not downvote you.
Ralf Meier 28-Aug-18 13:27pm
I'm sorry for compromising you ... I had a look at your reputation-points and if you have had downvoted me the negative points for me must be much greater.
So ... perhaps it was 'gacar' - but I don't know the reason. But of course : his comment which links to another Codeproject-Member wasn't useful ...

1 solution

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

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).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900