run vba function from different xls file

bestox

Board Regular
Joined
Apr 2, 2009
Messages
82
i would like to run a function from another file (in the same directory) and want to save the return value (it s a string) to a local string variable.

unfortunately, this

Code:
dim x as string
x = Run "'filename.xls'!Modul1.update"

does not work.

what code do i need, to save the result of the function to my variable x?

thank you!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Have you tryed getting the file to open your other file and running the script with a call function?
 
Upvote 0
my mistake.

this works:
Code:
Run "'filename.xls'!Modul1.update"

but this does not work:

Code:
dim x as string
x = Run "'filename.xls'!Modul1.update"
 
Upvote 0
maybe is should add, that function update looks like that:

Code:
Function update() As String
 
Upvote 0
Code:
dim x as string
x = Application.Run("'filename.xls'!Modul1.update")
should do it.
 
Upvote 0

Forum statistics

Threads
1,214,424
Messages
6,119,401
Members
448,893
Latest member
AtariBaby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top