Click here to Skip to main content
15,884,099 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 ...
Posted
Updated 27-Aug-18 0:11am
v4
Comments
gacar 23-Aug-18 18:23pm    
You can ask to him. https://www.codeproject.com/script/Membership/View.aspx?mid=4072603
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.

1 solution

By the Tip of "011111100010‬" I found this as my Solution :
VB
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).
 
Share this answer
 
v2

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