I've yet another problem which is making me crazy. This is a boiled down version of a problem, but it seems to be the smallest version of things that reproduces the problem:
Public Sub TestApplication()
Dim S As String
S = ClosingPrices("fdsf", "fdsag", "hjhk")
S = Application.Run("<WB Name>.xlsm'!TestTest", "FDF", "gfdgs", "jgfdg")
S = Application.Run("'<WB Name>.xlsm'!ClosingPrices", "FDF", "gfdgs", "jgfdg")
Public Function TestTest(arg1 As String, arg2 As String, arg3 As String) As String
TestTest = ClosingPrices(arg1, arg2, arg3)
Public Function ClosingPrices(TxtFileName As String, WBName As String, HistoryName As String) As String
The first call to ClosingPrices works just fine and the macro runs without a problem, as does the second, but the third, calling it directly through application.run, fails at that line (stepping through) with error message 1004 "Cannot run the macro ''<WB Name>.xlsm'!ClosingPrices'. The macro may not be available in this workbook or all macros may be disabled".
I've tried with and without the workbook name in the command portion of the call, but it fails either way. Obviously, this isn't the real call to ClosingPrices, but when called with real data from this workbook, it runs correctly.
Office 2007 on xpsp3 on a new computer. This construct has been working for quite a while on 2007, though this particular function is new.
I'm completely lost. Any ideas??