Shippwreck
Programmer
Hey Guys,
I'm writing a program in Excel and it needs to use a macro written in a different Excel spreadsheet. Now the problem is how to call that other Macro. If i set a reference to the other sheet and call it like this:
CountNumberOfRecords being the remote macro.
It works fine and i get the correct result. However i don't want to set a reference to the other sheet as it will not always be in the same place and the people using it wont know how to change the reference. So looking on the net i have found this:
(before this line i obviously open and activate the remote file)
It doesn't throw up any errors, however the value assigned to Record_Count, rather than being a number is "Error 2015" which when i look up i think is a syntax error, however as i said i don't get any error messages, the program just runs.
Now i have been searching the forums here (in fact i have never done this before and is how i came up with the two solutions above) however it is solution two that i need to work and i can't seem to get it too, so any help would be much appreciated.
Thanks
"Google is god...of the internet" - Me
I'm writing a program in Excel and it needs to use a macro written in a different Excel spreadsheet. Now the problem is how to call that other Macro. If i set a reference to the other sheet and call it like this:
Code:
Record_Count = CountNumberOfRecords(varFile2)
It works fine and i get the correct result. However i don't want to set a reference to the other sheet as it will not always be in the same place and the people using it wont know how to change the reference. So looking on the net i have found this:
Code:
Record_Count = Application.Run(CountNumberOfRecords, varFile2)
It doesn't throw up any errors, however the value assigned to Record_Count, rather than being a number is "Error 2015" which when i look up i think is a syntax error, however as i said i don't get any error messages, the program just runs.
Now i have been searching the forums here (in fact i have never done this before and is how i came up with the two solutions above) however it is solution two that i need to work and i can't seem to get it too, so any help would be much appreciated.
Thanks
"Google is god...of the internet" - Me