I am sorry to trouble the community with this trivia, but I am stuck. I have a Word file that has macro that I have tested within the word file. The macro has a parameter that has to be passed to do it. The parameter will signal to the code whether this macro has been called from the Word file, and now hopefully whether it has been called from Excel, where it will do slightly differently things.
When I did not have to make this switch in the code, the stackflow community provided me with perfectly functioning "run" method as:
'objW.Run "'" & d.FullName & "!" & MacroName 'This worked when the Macro did not have any parameters...
I now have tried the following 7 different versions (obviously one at a time before I commented them out), none of which work
Callcode = "Excel"
MacroName = "GetCodedData"
'objW.Run "'" & d.FullName & "!" & MacroName , & Callcode 'Version 1
'objW.Run ("'" & d.FullName & "!" & MacroName ", " & Callcode) 'Version 2
'objW.Run ("'" & d.FullName & "!" & MacroName, Callcode) 'Version 3
'objW.Run "'" & d.FullName & "!" & MacroName(Callcode) 'Version 4
'objW.Run "'" & d.FullName & "!" & MacroName "("Callcode")" 'Version 5
'objW.Run "'" & d.FullName & "!" & MacroName & "(" & Callcode & ")" 'Version 6
'objW.Run "'" & d.FullName & "!" & MacroName, varg1:=Callcode 'Version 7
Version 1,2,3,5 give Compiler errors. Version 4 gives run time error 13 (mismatch type, but my variables are declared to match the macro), and version 6 gives "can't run the specified macro" and version 7 gives error 438. I am obviously missing something obvious.